From java 9 we can create JPMS layers and dynamically add modules to it. At the 
same time different types of java archives can be JPMS modules - .jar, .war, 
.ear. However, the problem is that it is possible to add only .jar archives by 
default. I opened an issue here  
https://bugs.openjdk.java.net/browse/JDK-8203330  and as it was found out it is 
necessary to implement custom ModuleFinder. 

Trying to implement ModuleFinder I understood that it is necessary to rewrite 
(or take from) the "half" of jdk.intenal what is a very bad way. 

Lets' consider what I need to add .war arhives to JPMS layer. I need: 1) to 
understand if I can work with this type of archive or I can not (if .war is 
supported) 2). to map file location, for example instead of "module-info.java" 
I must find "WEB-INF/classes/module-info.java" etc. For that I don't need to 
create ModuleDescriptor, ModuleReference, ModuleFinder. 

So I suggest to overload ModuleFinder.of() method adding as a parameter custom 
ModuleReaderFactory. For example to add ModuleFinder#of(ModuleReaderFactory 
factory, Path... entries). ModuleReaderFactory must have such method - 
createModuleReader(Path path). Such solution will also help Jakarta EE 
developers a lot of. 


Best regards, Pavel

Reply via email to