I want to run a simple exec command post maven install phase. What is the simplest way possible to achieve this? (without adding new plugins)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to run this command as part of the normal build lifecycle, there is no other way than binding the
execgoal on theinstallphase:I did a simple test using the configuration above (using
lsas “COMMAND”) with a freshly created maven project and runningmvn installproduces the following output:$ mvn install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building maven-exec-testcase [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ ... [INFO] [install:install {execution: default-install}] [INFO] Installing /home/pascal/Projects/maven-exec-testcase/target/maven-exec-testcase-1.0-SNAPSHOT.jar to /home/pascal/.m2/repository/com/mycompany/app/maven-exec-testcase/1.0-SNAPSHOT/maven-exec-testcase-1.0-SNAPSHOT.jar [INFO] [exec:exec {execution: my-exec}] [INFO] pom.xml [INFO] src [INFO] target [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12 seconds [INFO] Finished at: Tue Jan 05 19:26:04 CET 2010 [INFO] Final Memory: 11M/75M [INFO] ------------------------------------------------------------------------As we can see, the command is executed at the end of the
installphase (after the copy of the artifact to the local repository).And if you really don’t want to add the snippet to your pom, then you’ll have to explicitly call
exec:execafterinstallon the command line as suggested by whaley.