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

Alex Orlov ooo_saturn7 at mail.ru
Sun Nov 15 19:16:18 UTC 2020


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