My question: when building a minimal JRE, how can one make sure that no required module is missing?
To illustrate the question, here is an example where I want to build a minimal JRE for my project. Let's assume for this example that logback is my only dependency.
I run the following command to see what modules are required:
$ jar --file=logback-core-1.2.3.jar --describe-module
No module descriptor found. Derived automatic module.
logback.core@1.2.3 automatic
requires java.base mandated
contains ch.qos.logback.core
contains ch.qos.logback.core.boolex
etc. (there are more "contains ch.qos.logback.XXX" lines)
It looks like I only need the java.base
module and I build my minimal JRE accordingly:
jlink --output jre-min --add-modules java.base
However when running the project with the minimal JRE, I encounter issues using logback's email logger (malformed emails over TLS). Through trial and error, I find that jdk.crypto.cryptoki
module is also required:
jlink --output jre-min --add-modules java.base,jdk.crypto.cryptoki
Now my project works fine. How could I have avoided the trial & error step?