I am new to Maven build. Can some one let me know if there is any way we can trigger a job which will run a batch file after successful completion of build in Maven?
1 Answers
Since you didn't provide details on how you are invoking maven, I'm going to just assume some things.
Continuous Integration: If you are using some kind of continuous integration like Jenkins/Hudson, or Travis CI, you should be able to add your batch file as a post-build step that gets executed on success of the build. Alternatively, you could have a separate job that runs your batch script that gets kicked off by the maven build's job.
IDE Configuration: If you are trying to do it with Intellij or some IDE, you will likely need to make a batch configuration that runs your maven build and then your desired post-build batch file.
Command line/mvn directly:
If you are running this by yourself on the command line using normal mvn install
commands, you are either going to want to circle back to having a batch file that kicks off maven for you and then runs your next script, or look into a plugin similar to this question (Note that there are some concerns with this approach, so be careful).
If none of these scenarios describe your situation, you are going to want to provide more information to your question before you get any solid feedback.
Thanks!

- 1
- 1

- 780
- 7
- 16
-
Thanks Alex , I am using command line for maven build . If i am running a batch file which kicks off maven first and then my batch script there will be no guarantee that post successful build my batch script will be executed . Is there any way to solve this issue ?? – Manoj Sep 08 '16 at 08:57
-
Why wouldn't you have a guarantee? Are you asking how to distinguish if the mvn build fails or succeeds? – alexanderific Sep 09 '16 at 22:59