On 21/06/2020 19:52, Alex Orlov wrote:
Hi all,
New version of maven-failsafe-plugin (3.0.0-M5) has been released and now it is possible to have two module-info in one
project — one in src/main/java and one in src/test/java  and to test modules on 
module -path.
Trying to use it I found the following.
Failsafe detects right module list using poms and adds it. The problem is that there are jars with module-info, with
Automatic-Module-Name and jars without anything. And if any module doesn’t show 
explicit dependency,
module is not added to boot layer by JPMS. For example, I have many hours story 
with hibernate and fasterxml.
In module path I saw:
/home/alex/.m2/repository/org/hibernate/hibernate-core/5.4.14.Final/hibernate-core-5.4.14.Final.jar
/home/alex/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar
However, I got java.lang.NoClassDefFoundError: 
com/fasterxml/classmate/TypeResolver
Only later, I noticed that on boot layer I had only hibernate (without 
module-info) but
fasterxml (with module-info) was ignored by our lovely JPMS.
If hibernate is an automatic module, and if is indeed resolved, then every observable automatic module will also be resolved. Is there any way to get maven-failsafe-plugin to reveal the command line that it is using? Alternatively, is there any way to inject the "--show-module-resolution" option into the command line that it uses? That will help to discovered if hibernate is actually resolved.
So, it is necessary to add missed modules via test module-info to boot layer what is a very silly work:
1) you add to you pom dependencies that you don’t use
2) failsafe detects right dependencies using pom files and does it very well.
So, could anyone answer two my questions:
1) Is it possible to force JPMS to add modules even if it think that they won’t 
be used
(by the way — nobody asks it).
2) As I understand this problem doesn’t appear when we create child layer and 
add any jars to it.
In this case JPMS doesn’t ignore any modules. Is this statement right?
If you are add "--add-modules" to the command line then it will allow you to make sure that jackson is in the boot layer. That said, it may mask some other issue so finding a bit more on what maven-failsafe-plugin is doing will help the discussion here.

-Alan

Reply via email to