modules or not modules

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

modules or not modules

Romain Manni-Bucau
Hello guys,

Played a bit with java 11 today, my goal was to create a native image.
So long story short i took maven jlink plugin, a small meecrowave (tomcat+openwebbeans+cxf) app, added a module-info.java file and ran.

After some tweaks and adjustments i managed to compile (which is always the first step),
fixed some issues in the stack (this does not support anymore overlapping packages between jars)
and finally arrived at jlink stage.

Here the issue is that all the stack is either unamed modules or automatic modules (allowing to run on java11 with stable names). Automatic module names are not supported by jlink cause they more or less say "we want the JRE" vs "we want this module and this one and this one etc". Note that this is just not theorical but hardcoded in jdk/tools/jlink/internal/JlinkTask.java

This is quite frustrating after having done all the work so I wonder if we should start considering jpms more seriously.

Here the items I can see:

1. make all our spec jar j11 friendly (the names we are using don't work cause of number positions), we should at least make them with an automatic name (think there is a pending PR) but also check it is the standard name otherwise we'll break the graph (javax.activation wouldnt work with jaxb which expects java.activation for instance)
2. do we make/reuse a plugin to be able to keep the current packaging but also do another jar with a module-info.class (with the classifier jpms?)? I found https://github.com/raphw/modulemaker-maven-plugin and https://github.com/moditect/moditect#generating-module-infojava-descriptors, with some hack we can make it duplicating the default jar task which would exclude module-info and another one with classifier jpms including the file and default resources

Wdyt?

Side note: if unclear, if we don't do that and stay with automatic module names we can run on java 11 but we can't go native (which is not a big blocker for now but can in some years)

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book