Java 8 and 9+, variant aware example

Hi,

although I am reading again and again the docs (here) I can’t understand basically which structure the project should have

If I want a library to come in two variants, one for jdk8 and one for jdk9+, what should I do?

One repository, two branches? Or a single branch with different directories?

Is there a clear example somewhere? I tried to search but I couldn’t find anything