Skip to content

Instantly share code, notes, and snippets.

@cesarmiquel
Created September 29, 2012 05:16
Show Gist options
  • Save cesarmiquel/3803248 to your computer and use it in GitHub Desktop.
Save cesarmiquel/3803248 to your computer and use it in GitHub Desktop.
Compile a maven process and deploy exploded war
#!/bin/bash
# Execute a command and display command with colors in console
exec() {
CMD=$*
S="\033[37mExecuting [\033[32m$CMD\033[37m]"
echo -e $S
eval $CMD
}
#
# Config
#
TMPDIR=tmp-`date +%y%m%d%H%M`
WARNAME="jsf-tasa-console-3.2.9.war"
WARDIR="$TMPDIR/$WARNAME"
DEPLOYDIR="$JBOSS_HOME/server/default/deploy"
# Borrar version anterior si esta
[ -e "$DEPLOYDIR/$WARNAME" ] && exec "rm -Rf $DEPLOYDIR/$WARNAME"
# Compilar
exec 'mvn install'
if [ $? -eq 1 ]
then
echo 'Build failed. Not installing ----- '
exit 0
fi
exec "mkdir -p $WARDIR"
exec "/usr/bin/unzip console/target/jsf-tasa-console-3.2.9.war -d $WARDIR"
exec "mv $WARDIR $DEPLOYDIR/"
exec "rm -Rf $TMPDIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment