<< HP 2910al CPU spike due to 'Debug & Test' process | Home | Raspberry Pi Image Download Page >>

Colorized Apache Ant Output at the OSX Bash Prompt

Readability rocks
Bookmark and Share

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:

  1. creation of an ant wrapper script
  2. 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!

Tags :



Add a comment Send a TrackBack