badass-jlink-plugin icon indicating copy to clipboard operation
badass-jlink-plugin copied to clipboard

Jlink task complaining about duplicate exports when using JDK with preinstalled javafx

Open Siedlerchr opened this issue 5 years ago • 2 comments

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

Siedlerchr avatar Aug 05 '20 06:08 Siedlerchr

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.

siordache avatar Aug 05 '20 08:08 siordache

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.

Siedlerchr avatar Aug 05 '20 09:08 Siedlerchr