Created
May 14, 2010 16:57
-
-
Save jawspeak/401376 to your computer and use it in GitHub Desktop.
make.sh maven wrapper
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
#!/usr/bin/env bash | |
# make.sh script to build maven | |
path=$(cd ${0%/*} && pwd -P) | |
. $path/mvnopts | |
# contents of mvnopts: | |
# export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m" | |
usage() | |
{ | |
cat <<EOF | |
usage: $0 [-c | -l | -r] [OPTIONS] | |
This script will run mvn clean install with mvnopts. | |
OPTIONS: | |
-c Core Profile | |
-l some-other Profile | |
-C Clean (use after update or when you delete files) | |
-s Compile tests, but do not run them | |
-S Do not compile or run tests | |
-v Use notify-send when build completes or fails | |
-m modules Only build specified modules | |
-a With Aspects (Slower) | |
-z With Compress (Really slow) | |
-o Offline | |
-U Force a check for updated releases and | |
snapshots on remote repositories | |
-h Show this message | |
EOF | |
} | |
SKIPTESTS="" | |
NOTIFY="" | |
CLEAN="" | |
ASPECTS="" | |
COMPRESS="" | |
OFFLINE="" | |
PROJECTS="" | |
UPDATE_SNAPSHOTS="" | |
while getopts "clCsSvazohUm:" OPTION | |
do | |
case $OPTION in | |
h) | |
usage | |
exit 1 | |
;; | |
a) | |
ASPECTS="with-aspects," | |
;; | |
c) | |
PROFILE="core" | |
;; | |
# we have multiple ways to build the app - this is following branch by abstraction, | |
# instead of literal SCM branches. | |
l) | |
PROFILE="branchByAbstractionProfile2" | |
;; | |
C) | |
CLEAN="clean" | |
;; | |
s) | |
SKIPTESTS="-DskipTests" # tests compile but do not run | |
;; | |
S) | |
SKIPTESTS="-Dmaven.test.skip=true" # tests do not compile or run | |
;; | |
U) | |
UPDATE_SNAPSHOTS="-U " | |
;; | |
v) | |
NOTIFY="notify-send -t 300000" | |
;; | |
z) | |
COMPRESS="compress," | |
;; | |
o) | |
OFFLINE="-o" | |
;; | |
m) | |
PROJECTS="--projects $OPTARG" | |
;; | |
?) | |
usage | |
exit | |
;; | |
esac | |
done | |
command="mvn $OFFLINE -P$ASPECTS$COMPRESS$PROFILE $CLEAN $UPDATE_SNAPSHOTS install $SKIPTESTS $PROJECTS" | |
echo "Executing: $command" | |
# notify is a really great tool (send-notify on KDE) that pops up an alert when the build is done | |
if [[ -n $NOTIFY ]]; then | |
($command && $NOTIFY "Build Complete" && exit 0) || ($NOTIFY "Build Failed" && exit 127) | |
else | |
$command | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment