I miss Ant's AnsiColorLogger. So I found a blog post and another blog post, spent some time messing around, and decided to share the results on GitHub. It works by wrapping your wrapping your Maven command and then inserting ANSI colour codes in the output.
- put the file in a handy directory (like ~/scripts)
- add a link to it in your .bashrc (or other shell's initialization file)
- example below:
mkdir -p ${HOME}/scripts # make a place for the script to live
cp mvn ${HOME}/scripts echo "[[ -s \"${HOME}/scripts/mvn\" ]] &&
source \"${HOME}/scripts/mvn\"" >> ${HOME}/bashrc # add to RC file
. ${HOME}/bashrc # to re-read your bash configuration
- alternatively, in recent Ubuntu Linux the default ~/.bashrc looks for alias additions in a separate file, that you can simply append to:
curl https://raw.github.com/builddoctor/maven-antsy-color/master/mvn >> ~/.bash_aliases
With a u in it. Until you realise that you're outnumbered by people who use the Georgian-era spelling