Colorized Apache Ant Output at the OSX Bash Prompt
Readability rocks
For years I've wanted colorized output from Apache Ant when compiling my Java projects. Until today I never really look into it. But a quick Google search lead me to Stack Overflow: Problem with Ant's AnsiColorLogger in Snow Leopard. While the existing answer works, it was slightly inellegant in its need for two changes:
- creation of an ant wrapper script
- adding an alias for ant to point to the wrapper script
By harnessing the raw power of Bash Functions (!) we can do this with a single line in the .profile file. No need to have a wrapper script.
ant () { command ant -logger org.apache.tools.ant.listener.AnsiColorLogger "$@" | sed 's/2;//g' ; }
Ta da! Looks great!
