title: Gradle, Java 8 and 9+, variant aware example
body: <p>I read Gradle is <em>variant aware</em></p>
  
  <p>well, I'd like to have a library come in two variants, one for jdk8 and one for jdk9+</p>
  
  <p>Although I am reading again and again the <a href="https://docs.gradle.org/current/userguide/variant_model.html#sec:abm_configuration_attributes" rel="nofollow noreferrer">docs</a> I just can’t grasp which structure the project should have</p>
  
  <p>One repository, two branches? Or a single branch with different directories?</p>
  
  <p>Is there a clear example somewhere? I tried to search but I couldn’t find anything</p>
  
  <p>Edit: related, <a href="https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html" rel="nofollow noreferrer">Gradle Module Metadata</a> and <a href="https://www.baeldung.com/gradle-6-features" rel="nofollow noreferrer">this</a></p>