badass-jlink-plugin
badass-jlink-plugin copied to clipboard
Jlink task complaining about duplicate exports when using JDK with preinstalled javafx
Hi,
in JabRef we noticed a strange bug:
When we use the LIbericaJDK Full (includes javafx) to run jlink/jpackage it fails with an error like:
Error: Modules org.jabref.merged.module and javafx.graphics export package javafx.scene.text to module org.jabref
javafx is defined in the build.gradle as dependency
Interestingly, when I use the AdoptOpenjdk which does not include javafx, it works fine. Somehow it seems the existing javafx installation is creating conflicts
That's actually the expected behavior, because the javafx libraries are included twice in your build.
If you use a JDK that already includes JavaFX, you should remove from build.gradle the code that adds the OpenJFX libraries to your custom runtime image. Start by removing these lines:
id 'org.openjfx.javafxplugin' version '0.0.9'
...
javafx {
version = "14"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing' ]
}
...
forceMerge "javafx"
Some other changes may be also necessary - I didn't try it.
Thanks for the explanation. That's what I thought as well, but didn't know it was expected behaviour. I though it's ignoring them.