aboutsummaryrefslogtreecommitdiff
path: root/mvnw.sh
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2021-03-26 12:58:56 +0100
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2021-03-26 12:58:56 +0100
commitf54922269049658bdd53adadd1055e15fd490fba (patch)
treec00a8a1f731d1d95e3f33f288527f2215b509f1a /mvnw.sh
downloadacme-scripts-f54922269049658bdd53adadd1055e15fd490fba.tar.gz
acme-scripts-f54922269049658bdd53adadd1055e15fd490fba.zip
Initial commit
Diffstat (limited to 'mvnw.sh')
-rwxr-xr-xmvnw.sh74
1 files changed, 74 insertions, 0 deletions
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
+