I'm executing a Maven deploy task from a bash script however even if the Maven task fails the script will continue and complete without errors.
I have tried the -e flag but that causes the deploy to fail. I also tried the following (pseudo code)
result_code= mvn deploy
if [$result_code -gt 0];then
exit 1
Any suggestions how i can identify if the deploy was successful?
result_code=mvn deploy
is not the way to get return statusyou can try e.g. :
In addition if anyone using Windows 10, here is the example which I use:
Just one other possible reason a person's mvn task may return 0 despite failing: be careful about piping the output of maven to other programs. For example, I'm using
grcat
(whichgrc
is build on top of), which will always return exit code 0;I'm not sure how to retain my nice color coding of the output. There is color_maven.sh out there but that has other issues.