The m2eclipse plugin has a project option “Resolve dependencies from Workspace projects” that tells downstream Maven projects to use the target/classes
directory of the upstream dependencies instead of using packaged jars. Is there any way to tell mvn
to do the same thing?
For example, if I have have two projects, foo
and bar
, and bar
depends on foo
, then on the command line I have to package and install foo
before I can run bar
:
cd ~/foo
mvn package install
cd ~/bar
mvn prepare-package
java -cp target/classes:$(mvn -o -q -Dmdep.outputFile=/dev/stdout dependency:build-classpath) Bar
But I want to avoid packaging all the projects because 1) it’s a lot of redundant I/O, and 2) if I save in Eclipse and run from the command line it’s easy to forget to package all the projects again, and then I’ll waste time wondering why my changes didn’t work.
So is there any way to change pom.xml
so that the mvn
command uses the unpacked classes from mvn prepare-package
instead of the mvn install
repository?