openjfx / javafx-maven-plugin

Maven plugin to run JavaFX 11+ applications
Apache License 2.0
371 stars 59 forks source link

Adding example how to include extra module when executing jlink goal #149

Open jan-tosovsky-cz opened 2 years ago

jan-tosovsky-cz commented 2 years ago

In my JavaFX app I do some ZIP processing, but hit java.nio.file.ProviderNotFoundException with jlink created runtime because jdk.zipfs dependency was not properly auto-detected. https://stackoverflow.com/questions/57846630/java-nio-file-providernotfoundexception-with-jlink-created-runtime While the solution is clear, I have no idea if --add-modules jdk.zipfs can be accomplished by the plugin.
I'd be grateful to add an example for this into README.md or clearly state this is not possible. It would help others in the future.

jan-tosovsky-cz commented 2 years ago

Not sure if this is best solution, but I simply added jdk.zipfs to my module-info.java as required module:

    requires javafx.controls;
    requires javafx.fxml;
    requires java.xml;
    // jdk.zipfs module is not auto-detected by default so adding explicitly here
    requires jdk.zipfs;

It is then detected by jlink and properly included in the final runtime image.