question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add module picocli-jpms (was: Include module-info.class for full JPMS modularization and jlink support)

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:61 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
Warkdevcommented, Apr 12, 2019

Done boss!

1reaction
jennettwheelercommented, Apr 2, 2019

Thanks for these links. Will be useful for learning gradle for me too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jlink - Oracle Help Center
You can use the jlink tool to assemble and optimize a set of modules and their dependencies into a custom runtime image.
Read more >
Generate module-info using jlink for an external JAR
I generated the module-info.java through the help of my ide. I am using STS 4.6.2. I just right-clicked on my project -> configure...
Read more >
14 Customizing runtime images with jlink - The Java Module ...
This chapter covers: creating runtime images that contain just the platform modules an app needs; creating application images, which also include application ...
Read more >
Introduction to jlink - Matthew Gilliard's blog
Full Answer: You can use the jlink tool to assemble and optimize a set of modules and their dependencies into a custom runtime...
Read more >
Java Modules - are they common and should we use them?
Nobody on the JDK lifted a finger to help add module support to ... We have 2 services using the JPMS and 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found