I'm trying to execute a Java file in a subproject in a maven reactor project. This is similar to the question Maven exec:java goal on a multi-module project, but unless I do a mvn install
then the exec plugin can't find the class that I'm trying to run in the subproject.
Perhaps I misunderstand the intended workflow of mvn install
, but having to do mvn install every time I make changes really complicates the workflow.
When I execute the file from Eclipse, Eclipse sets up the classpath correctly (i.e. module1/target/classes
, module2/target/classes
) and I want to emulate this behaviour from the command line. I thought doing mvn -pl exec:java -Dexec.mainClass=...
would set up the classpath in this way, but the class is not found in this case.