jlink --add-modules not applied to launcher
Eirik Bjørsnøs
eirbjo at gmail.com
Tue Apr 25 11:30:38 UTC 2023
Hi,
I'm working on a Maven plugin which calls jlink to produce a runtime image.
The launcher main method sets up a graph of ModuleLayers. The module jar
files for these layers are added to runtime image folder
lib/myframework/modules by the Maven plugin, along with some metadata
defining the graph of ModuleLayers to be constructed.
Since the "actual" module graph in this case isn't visible for jlink, the
Maven plugin inspects all module descriptors and collects all "java.*"
required modules which it adds to the "-add-modules" jlink option. This
works fine in the sense that the these modules are included in the
runtime image.
When executing the custom launcher however, the required images are not
added to the boot layer. The only way I've found so far to get around this
is to add "--add-modules java.sql" etc to the JLINK_VM_OPTIONS environment
variable in the launcher script. This file can of course be edited by my
Maven plugin, but this feels a bit dirty.
So far I haven't found a way to tell jlink which modules should be added to
the launcher's boot modules. Am I missing some switch?
PS: I know I could just add all modules via --add-modules instead of
building my custom layer graph, but that graph is there for reasons and I
don't think it will run well on a collapsed boot layer.
Thanks,
Eirik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20230425/5d6daac9/attachment-0001.htm>
More information about the jigsaw-dev
mailing list