Last active
June 6, 2016 10:31
-
-
Save ankon/d6a0eb6040eff6f8eb38631bfaa411e3 to your computer and use it in GitHub Desktop.
Taming Maven Verbosity on Travis
This file contains hidden or 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
#!/bin/sh | |
# Filter maven output and inject 'travis_fold'/'travis_time' markers | |
exec awk ' | |
BEGIN { | |
attn=0 | |
id=0 | |
start=0 | |
end=0 | |
} | |
{ | |
if (attn==1 && match($0, /^\[INFO\] Building /)) { | |
if (id>0) { | |
if (start>0) { | |
"date +%s%N"|getline end | |
close("date +%s%N") | |
printf "travis_time:end:maven.%d:start=%d,end=%d,duration=%d\n", id, start, end, (end-start) | |
} | |
printf "travis_fold:end:maven.%d\n", id | |
} | |
id++ | |
printf "travis_fold:start:maven.%d\n", id | |
"date +%s%N"|getline start | |
close("date +%s%N") | |
printf "travis_time:start:maven.%d\n", id | |
} else if (match($0,/^\[INFO\] -+$/)) { | |
attn=1 | |
} else { | |
attn=0 | |
} | |
} | |
END { | |
if (id>0) { | |
if (start>0) { | |
"date +%s%N"|getline end | |
close("date +%s%N") | |
printf "travis_time:end:maven.%d:start=%d,end=%d,duration=%d\n", id, start, end, (end-start) | |
} | |
printf "travis_fold:end:maven.%d\n", id | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using this as a filter will kill the maven exit status, so use it like this when you need the status:
See also: http://stackoverflow.com/a/16530815/196315