I have a multi-module project, i.e.
parent
module1
module2
In one dev cycle, I added a class mod1.A
to module1. Class mod2.B
in module2 depends on it.
I do not have the artifacts in my local .m2/repository
. Running this:
$ cd prj/module2
$ mvn -o exec:java -Dexec.mainClass=mod2.B
results in an error along the lines of:
The following artifacts could not be resolved: com.example:module1:jar:1.0-SNAPSHOT
After I install the artifacts via mvn install
while in the prj
folder, it all works as expected.
However, this presents an issue in at least two ways:
- I have to go through the slower install phase instead of the faster compile phase
- I have two versions of the same project and conflicting modifications in these. I cannot run the same Java class with their respective modifications, only the currently installed modifications, considering they are both the same SNAPSHOT version
There are workaround for both (skip parts of the build for the first, different snapshot versions for the second), but they are far from usable in practice.
Is there a way to make maven use the local modules, instead of using artifacts from local maven repository?