Created
January 4, 2012 15:46
-
-
Save msgodf/1560626 to your computer and use it in GitHub Desktop.
Colour Maven output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modified from http://repo.or.cz/w/anomen-overlay.git/tree/HEAD:/dev-java/maven-color | |
color_maven() { | |
local BOLD=`tput bold` | |
local TEXT_RED=`tput setaf 1` | |
local TEXT_GREEN=`tput setaf 2` | |
local TEXT_YELLOW=`tput setaf 3` | |
local RESET_FORMATTING=`tput sgr0` | |
$MAVEN_HOME/bin/mvn $@ | sed -e "s/\(\[INFO\]\ \-\-\-\ .*\)/${TEXT_BLUE}\1${RESET_FORMATTING}/g" \ | |
-e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}\1${RESET_FORMATTING}/g" \ | |
-e "s/\(\[INFO\]\ \)\(BUILD SUCCESS\)/\1${TEXT_GREEN}\2${RESET_FORMATTING}/g" \ | |
-e "s/\(\[INFO\]\ \)\(BUILD FAILURE\)/\1${TEXT_RED}\2${RESET_FORMATTING}/g" \ | |
-e "s/\(\[WARNING\].*\)/${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \ | |
-e "s/\(\[ERROR\]\)/${TEXT_RED}\1${RESET_FORMATTING}/g" \ | |
-e "s/\(Exception in thread \".*\" \)\(.*\)/\1${TEXT_RED}\2${RESET_FORMATTING}/g" \ | |
-e "s/\(SUCCESS \)\[/${RESET_FORMATTING}${TEXT_GREEN}\1${RESET_FORMATTING}\[/g" \ | |
-e "s/\(FAILURE \)\[/${RESET_FORMATTING}${TEXT_RED}\1${RESET_FORMATTING}\[/g" \ | |
-e "s/\(Caused by: \)\([^:\t ]*\)/\1${TEXT_RED}\2${RESET_FORMATTING}/g" \ | |
-e "s/\(ERROR\ \[.*\)/${TEXT_RED}\1${RESET_FORMATTING}/g" \ | |
-e "s/Tests run: \([^,]*\), Failures: \([^,0]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${TEXT_YELLOW}\4${RESET_FORMATTING}/g" | |
echo -ne ${RESET_FORMATTING} | |
} | |
MAVEN_HOME=/opt/apache-maven-3.0.3 | |
alias mvn=color_maven | |
alias maven=$MAVEN_HOME/bin/mvn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment