jlink - excluding optional dependencies

Alan Bateman Alan.Bateman at oracle.com
Fri Feb 17 09:46:26 UTC 2017


On 17/02/2017 08:45, Gunnar Morling wrote:

> Hi,
>
> How can I exclude optional dependencies when creating a runtime image
> using jlink?
>
> In more detail, I have a module A which declares an optional
> dependency to another module B via "requires static". I'd like to
> create a runtime image which only contains A.
>
> When running jlink with "--add-modules A", I'm getting "Error: B not
> found". jlink finishes when I run it with "--add-modules A,B" but then
> B is part of the image, too, as per the images release file.
>
Thanks for bringing this up, it's something that was kicked around when 
`requires static` was added and I think dropped off the radar.

To re-cap, one question at the time was how well jlink plugins will cope 
with "dangling references". It's not an issue for the plugins that are 
currently enabled by default. There is another question on whether the 
module in the generated image retains the `requires static` or not.

-Alan


More information about the jigsaw-dev mailing list