Red and Green Maven Build
We have adapted on our project James Crisp's cool idea about changing the color of the command when the build fails or passes... Now it works for maven :)
mvncool.bat file
@echo offcolor 07
call mvn %*
IF ERRORLEVEL 1 goto RedBuild
IF ERRORLEVEL 0 goto GreenBuild:RedBuild
color 4F
goto TheEnd:GreenBuild
color 2F:TheEnd
It's quite similar to the one that Crisp posted, so thanks Crisp for the interesting and reusable bat file.
Some small things are different for maven though... Check them out.
Step by step to have it working on your maven project:
- Download this file mvncool.bat (or copy it from the text box above)
- Move mvncool.bat to either:
- the root of your project, where your root pom.xml is. You can also add this file to your version control so that everyone can use it.
- or any folder which is in your PATH. It could be the same folder where mvn.bat is: MAVEN_HOME/bin/. - From the root of your project, just from where you used to run your mvn you can from now on run mvncool instead. You can send the same parameters mvncool clean install for example and they will be sent through because of the %* on the bat file...
Before mvncool
mvn clean install
mvn package
mvn (anything)
Using mvncool
mvncool clean install
mvncool package
mvncool (anything)