-
Notifications
You must be signed in to change notification settings - Fork 446
Description
Currently the picocli jar is an automatic module (manifest has Automatic-Module-Name: info.picocli).
A JLink trimmed binary image needs explicit modules. This means the jar needs to include a
module-info.class.
Update: this is a common misunderstanding. See the comment below for a tutorial for creating a JLink binary image with an automatic module.
module-info.class trade-offs
It is possible to compile only the module-info.java file with Java 9 and include it in the picocli jar where all other classes are compiled with Java 5.
However, there are quite a few tools that scan all classes in a Jar and that would choke on the module-info.class (whether it is in the root of the jar or in META-INF/versions/9/). For example: jandex, and Apache Commons BCEL.
Consider producing a picocli-jpms-3.x.x.jar that has the same contents as picocli-3.x.x.jar but in addition a module-info.class. Users looking to create a JLink custom runtime image can use the picocli-jpms jar.
Solution
The comment below is a brief tutorial for creating a JLink binary image with an automatic module. No module-info.class required in picocli or in the application.
Todo: do a more formal write-up and add it to the picocli documentation.