Case in point, the Ikonli project defines classes that depend on JavaFX 8. Unfortunately these classes are marked as private. In JDK9 these classes were moved to a public space, thus a binary compatibility problem arises. See https://github.com/aalmiray/ikonli/issues/8 for more details.
There are (at least) two possible solutions: The old and tried by releasing multiple artifacts using a classifier, such as
ikonli-javafx-jdk9 (for JDK9 and newer) and
ikonli-javafx (for JDK8). The new way using MRJARs, which would allow different versions of the same class to be packaged inside the same JAR, thus allowing developers to configure a single dependency instead of trying to match the right classifier.
I’d rather go with the new way as that keeps things simpler for consumers of the project. Unfortuantely the Gradle Java9 Guide does not mention MRJARs at all, nor does it show how multiple sourceSects may be compiled targeting different JDK versions, say
src/main/java (set to JDK8) and
src/main/java9 (set to JDK9).
Any help would be appreciated.