My current project has a neat trick we picked up where the build has a red or green banner at the end when you run it locally to give good feedback about the build status. I’m not sure who originated it, but thanks!
I just had to tweak it a bit to get it working on OS X so I thought I would document the trick here.
It has also been run under Ubuntu where the following works (it didnt work on OS X which is why I adapted it), but the tput should also work on Ubuntu. I’ve not explicitly tested this one!
if [ "$?" -ne 0 ]; then
echo -e “\E[30;41m"
cat ./ci/failed.txt
echo -e "\E[0m"
exit 1
else
echo -e "\E[30;42m"
cat ./ci/passed.txt
echo -e "\E[0m"
exit 0
fi
Under windows you can actually make the entire screen of the terminal change color:
run.bat - WINDOWS
CALL tools\ant\bin\ant %*
IF ERRORLEVEL 1 GOTO RedBuild
IF ERRORLEVEL 0 GOTO GreenBuild
:RedBuild
color 4F
GOTO TheEnd
:GreenBuild
color 2F
:TheEnd
PAUSE
color 07
I'm afraid I had to update this post as initially I naively assumed that the syntax for environment variables was the same as for system properties. As you can see from above, you have to actually put a separate xml tag in there for the variable.
By putting the value in ${} you can then pass it in with -DsomeSystemProperty from the command line when you do mvn clean install