I have a multi-module project (5 modules) running on maven2 and I’d like to do the following:
-
Run MVN clean deploy in 3 modules
-
run MVN clean test in 2 modules.
Is there a way to accomplish this with a single Maven execution?
The goal is to avoid deploying modules which aren’t needed by any other projects making the build faster.
You can control which projects would skip deploy or test build lifecycle phases using profiles and set skip property in maven deploy and surefire plugins in those profiles in individual project.
However, deploy phase is the latest phase in the build lifecycle, so you will have to use something like Maven Invoker Plugin to spawn another Maven process.