Re: How to do “--add-modules” with dynamically created layer in JPMS?

Johannes Spangenberg johannes.spangenberg at hotmail.de
Sun Nov 15 23:56:30 UTC 2020


I think you need to specify the "implementation modules" in the last 
argument of Configuration.resolveAndBind(...).

Best regards,
Johannes

Am 15.11.2020 um 20:16 schrieb Alex Orlov:
> Hi all,
>   
> I create JPMS layer this way:
>   
> Configuration cf = parentLayer.configuration().resolveAndBind(moduleFinder, ModuleFinder.of(), moduleNames);
> ModuleLayer layer = parentLayer.defineModulesWithOneLoader(cf, parentClassLoader);
>   
> And I have a problem with adding implementation modules. These implementation modules are ignored by JPMS because classes from these modules are not used anywhere (it is clear, that classes from API modules are used). So, JPMS doesn't add these modules to layer.
>   
> As I understand, if I spoke about implementation modules on boot layer, I could use --add-modules jvm argument. However, I couldn't find any information how to force JPMS load my module (even if its classes are not used) for dynamically created layers.
>   
> Could anyone say how to do it?
>   
>   
> --
> Best regards, Alex Orlov


More information about the jigsaw-dev mailing list