Maven in colour / Maven en couleur

by Olivier on Oct 20th in Uncategorized

ENG : If you want to see maven in colour, you can just add an litle awk in a script :)

FR : Vous voulez voir maven en couleur, il suffit d’ajouter un petit awk dans un script :)

sudo vi /usr/local/bin/mvnc

#!/bin/sh
mvn $@ 2>&1 | awk ' ($1 == "[ALL]")     {
print "\033[1;37m" $0 "\033[0m"; next; } ($1 == "[FATAL]")     { print "\033[1;31m" $0 "\033[0m"; next; } ($1 == "[ERROR]")     { print "\033[1;31m" $0 "\033[0m"; next; } ($1 == "[WARNING]")     { print "\033[1;33m" $0 "\033[0m"; next; } ($1 == "[INFO]")     { print "\033[1;37m" $0 "\033[0m"; next; } ($1 == "[DEBUG]")     { print "\033[1;36m" $0 "\033[0m"; next; } ($1 == "[TRACE]")     { print "\033[1;32m" $0 "\033[0m"; next; } { print }' 

vi ~/.bashrc

...
alias mvn='JAVA_HOME=~/java/jdk/jdk6; mvnc' ...

Tags

One Comment

  1. Sean Flanigan

    7th November 2008

    [WARNING] Don’t use this to run interactive goals (eg mvn release:prepare), because you won’t see prompts unless they end with newline. Don’t ask me how I know, or how long it took to work out what was going on…

    Other than that, having colour output from Maven is great. There’s a colour patch for Maven logging at http://jira.codehaus.org/browse/MNG... .

Leave a Reply

Please note: Comment moderation is enabled and may delay your comment.

Powered By Wordpress Designed By Ridgey