Automatic module jpro.webapi requires "badass" magic for jlink
Automatic module jpro.webapi requires "badass" magic for jlink to work.
The badass-jlink plugin takes a more pragmatic approach by combining all non-modular dependencies into a single jar. This way, only the resulting merged module needs a module descriptor.
The following error message is emitted by a plain jlink call:
Error: automatic module cannot be used with jlink: jpro.webapi from file:///.../sormuras/bach-hansolos-spacefx/lib/jpro.webapi.jar
It'd be cool, if SpaceFX (at least the master branch) either:
- doesn't make use of code loaded from automatic modules at all, or...
- ...
jpro.webapiwas provided a Java module with a compiledmodule-info.class.
See https://github.com/sormuras/bach-hansolos-spacefx/runs/696413822?check_suite_focus=true#step:7:92 for a build log.
How to reproduce this error message?
With ./gradlew jlink i get another error message complaining about JavaFX missing.
When I can reproduce it, we will provide a solution for the jpro webapi jar.
Reproduce it on the bach branch at https://github.com/sormuras/bach-hansolos-spacefx/tree/bach
Just enter jshell -R-Debug https://sormuras.de/bach-build to trigger a build.
As mentioned above, the best (and future-proof) solution would be to include a compiled module-info.class with the JAR file. At the moment, it reads (pardon the German locale message):
jar --describe-module --file ...jpro-webapi-2019.2.3.jar
Kein Moduldeskriptor gefunden. Automatisches Modul wurde abgeleitet.
jpro.webapi automatic
requires java.base mandated
contains com.jpro.webapi
And a listing looks like:
jar --list --file ...jpro-webapi-2019.2.3.jar
META-INF/MANIFEST.MF
com/
com/jpro/
com/jpro/webapi/
com/jpro/webapi/SVGView.class
com/jpro/webapi/WebAPIConsumer.class
com/jpro/webapi/WebCallback.class
com/jpro/webapi/WebAPI.class
com/jpro/webapi/StageView$2.class
com/jpro/webapi/WebAPI$FileSelectedListener.class
com/jpro/webapi/ScriptResultListener.class
com/jpro/webapi/HTMLView.class
com/jpro/webapi/JProApplication.class
com/jpro/webapi/InstanceCloseListener.class
com/jpro/webapi/WebAPI$FileUploader.class
com/jpro/webapi/StageView.class
com/jpro/webapi/StageView$1.class
If you still have the abilitiy to set a new module name, I'd choose: com.jpro.webapi -- see https://github.com/sormuras/modules#about-java-module-names for a reasoning.
The listing should include one extra line:
module-info.class
META-INF/MANIFEST.MF
...
And the description could read:
com.jpro.webapi jar:file:///...jpro-webapi-2019.2.3.jar/!module-info.class
exports com.jpro.webapi
requires java.base mandated
Also remove the Automatic-Module-Name: jpro.webapi line from MANIFEST.MF.
Just ping me for any help.