Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic module jpro.webapi requires "badass" magic for jlink #8

Open
sormuras opened this issue May 21, 2020 · 4 comments
Open

Automatic module jpro.webapi requires "badass" magic for jlink #8

sormuras opened this issue May 21, 2020 · 4 comments

Comments

@sormuras
Copy link

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.webapi was provided a Java module with a compiled module-info.class.
@sormuras
Copy link
Author

@FlorianKirmaier
Copy link
Contributor

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.

@sormuras
Copy link
Author

sormuras commented May 21, 2020

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.

@sormuras
Copy link
Author

Just ping me for any help.

sormuras added a commit to sormuras/bach-hansolos-spacefx that referenced this issue May 26, 2020
- Update GIT ignore configuration
- Skip distribution creation and upload actions
- Add Build SpaceFX with Bach step
- Provide a custom build program for Bach.java
- Skip creation of custom runtime image: HanSolo#8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants