From f54922269049658bdd53adadd1055e15fd490fba Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Fri, 26 Mar 2021 12:58:56 +0100 Subject: Initial commit --- mvnw.sh | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 mvnw.sh (limited to 'mvnw.sh') diff --git a/mvnw.sh b/mvnw.sh new file mode 100755 index 0000000..e759acf --- /dev/null +++ b/mvnw.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +print() +{ + echo [`date +"%Y-%m-%d %H:%M"`] "$1" +} + +for arg in "$@" +do + case $arg in + compile) + descr="Compilation" + action=compile + ;; + test) + descr="Testing" + action="test" + noTrim="-DtrimStackTrace=false" + shift + ;; + -Dtest=*) + #params="${arg#*=}" + params="$arg" + shift + ;; + -v) + verbose=1 + ;; + esac +done + + + +T0=`date +"%s"` + +print "Starting Maven $descr" +echo + +IFS='' + +if [ "$action" == "compile" ]; then + OUTPUT=$(mvn compile \ + | while read line; do echo $line|grep ERROR; done \ + | grep -E "\[ERROR\] .*`pwd`" \ + | sed 's/^\[ERROR\] //g' \ + | sed 's/\[//g' \ + | sed 's/,/:/g' \ + | sed -E 's/\] (.*)$/ \[\1\]/g' \ + | sort \ + | uniq) + if [ ! -z $verbose ]; then + echo $OUTPUT + else + echo $OUTPUT | sed -E 's|\[.*\]||g' + fi + T1=`date +"%s"` + TT=`expr $T1 - $T0` + + echo + print "Maven $descr has endend. Time elapsed: $TT seconds" + + if [ ! -z "$OUTPUT" ]; then + MSG="With errors." + else + MSG="Successful!" + fi + + MSG=$MSG" Time elapsed: $TT seconds" + + notify-send "$descr completed" "$MSG" +else + mvn $action $noTrim $params +fi + -- cgit v1.2.3