I am converting a java project to use modules. One of my modules depends on hamcrest
library, and it needs both of the jar files hamcrest.core
and hamcrest.library
. These two jar files both have org.hamcrest
package. So when my module wants to treat these two jars as automatic modules, it fails because two modules in a module-path cannot have packages with same name. I searched a lot and found some related stuff on stackoverflow. It seems that I have two reasonable options if I do not want to rebuild those dependencies:
So here are my questions:
Thanks in advance
Ok I finally managed to solve it like this:
hamcrest-all
and add dependencies on hamcrest-core
and hamcrest-library
.maven-assembly-plugin
to this module with appendAssemblyId
set to false.hamcrest-core
and hamcrest-library
from other maven modules and instead add dependency to hamcrest-all
.hamcrest-core
and hamcrest-library
when including dependency to hamcrest-all
.What it actually does is that it unpacks hamcrest-core
and hamcrest-library
in the jar file created for hamrest-all
. And because each jar file is treated as one module by JMPS, the problem is gone :)