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.
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?
--
Alex Orlov