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:
- Merge the two jars into one jar using my build automation tool (which is maven).
- Somehow tell java compiler that these two jars should be treated as a single automatic module.
So here are my questions:
- Is any of these two options possible? If yes, how?
- Is there any better option?
Thanks in advance