Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (25 sloc) 1.12 KB
# thanks to: http://blog.blindgaenger.net/colorize_maven_output.html
# and: http://johannes.jakeapp.com/blog/category/fun-with-linux/200901/maven-colorized
# Colorize Maven Output
alias maven="command mvn"
function color_maven() {
local BLUE=""
local RED=""
local LIGHT_RED=""
local LIGHT_GRAY=""
local LIGHT_GREEN=""
local LIGHT_BLUE=""
local LIGHT_CYAN=""
local YELLOW=""
local WHITE=""
local NO_COLOUR=""
maven $* | sed \
-e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${LIGHT_GREEN}Tests run: \1$NO_COLOUR, Failures: $RED\2$NO_COLOUR, Errors: $YELLOW\3$NO_COLOUR, Skipped: $LIGHT_BLUE\4$NO_COLOUR/g" \
-e "s/\(\[\{0,1\}WARN\(ING\)\{0,1\}\]\{0,1\}.*\)/$YELLOW\1$NO_COLOUR/g" \
-e "s/\(\[ERROR\].*\)/$RED\1$NO_COLOUR/g" \
-e "s/\(\(BUILD \)\{0,1\}FAILURE.*\)/$RED\1$NO_COLOUR/g" \
-e "s/\(\(BUILD \)\{0,1\}SUCCESS.*\)/$LIGHT_GREEN\1$NO_COLOUR/g" \
-e "s/\(\[INFO\].*\)/$LIGHT_GRAY\1$NO_COLOUR/g"
return $PIPESTATUS
}
alias mvn=color_maven