jlink - excluding optional dependencies

Gunnar Morling gunnar at hibernate.org
Fri Feb 17 19:40:09 UTC 2017


> There is another question on whether the
> module in the generated image retains the `requires static` or not.

What would be the rational for removing it?

On first thought I'd say keep the descriptor as it is. One could
envision a tool for updating existing images, e.g. adding an optional
dependency originally omitted when creating the image.



2017-02-17 10:46 GMT+01:00 Alan Bateman <Alan.Bateman at oracle.com>:
> 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