I have to perform following steps in my maven build, in the specific order mentioned below:
- exec-maven-plugin
- maven-antrun-plugin
- exec-maven-plugin
- maven-antrun-plugin
- maven-remote-resources-plugin, jaxb2-maven-plugin
- maven-javadoc-plugin
- exec-maven-plugin
I have to use JDK 6, so using Maven 3.2.1.
In the pom file, I have defined 5 different profiles for #1, #2, #3, #4, #7 above (profile ids: p1, p2, p3, p4, p5). I am building my project using multiple commands:
- mvn exec:exec -Dp1 (for #1 above)
- mvn antrun:run -Dp2 exec:exec -Dp3 (for #2 and #3 above)
- mvn antrun:run -Dp4 (for #4 above)
- mvn clean install (for #5, #6 above and compile classes)
- mvn exec:exec -Dp5 (for #7 above)
The build works okay with multiple commands, but is it possible to execute all steps using one command i.e. mvn clean install ?
What I understand is, it is not possible to have multiple executions of exec-maven-plugin in non consecutive order, hence I used profiles and then execute each step using the profile id. Reference: Maven maven-exec-plugin multiple execution configurations