Skip to content

Instantly share code, notes, and snippets.

@chrisweibel
Created February 29, 2012 23:32
Show Gist options
  • Save chrisweibel/1945437 to your computer and use it in GitHub Desktop.
Save chrisweibel/1945437 to your computer and use it in GitHub Desktop.
jboss deployment script
# Simple JBoss7 helper functions
# set var to jboss home dir
JBOSS_HOME="/usr/local/jboss/jboss-as-web-7.0.2.Final"
#Start BBoss
alias jboss-start="sudo $JBOSS_HOME/bin/standalone.sh"
#Stop JBoss
alias jboss-stop="sudo $JBOSS_HOME/bin/jboss-admin.sh --connect command=:shutdown"
#Is JBoss running?
alias jboss-is-running="ps -ef | grep jboss"
#removes all deployments from jboss
function jboss-clean() {
sudo rm -rf $JBOSS_HOME/standalone/deployments/*
}
#Perform and exploded deploy
#This makes two assumptions.
# 1: you are in the root of your project (where your pom.xml is)
# 2: your working directory is named the same as your project's war
function jboss-exploded-deploy() {
#if war is currently deployed, undeploy it
#this might also be done with a marker file????
if [ -d "$JBOSS_HOME/standalone/deployments/${PWD##*/}.war" ] ; then
#remove war dir
sudo rm -rf $JBOSS_HOME/standalone/deployments/${PWD##*/}.war*
fi
#build and package war
mvn -q clean package -DskipTests
#unzip to jboss deployment folder
sudo unzip target/${PWD##*/}.war -d $JBOSS_HOME/standalone/deployments/${PWD##*/}.war > /dev/null
#drop deployment marker so jboss will deploy
sudo touch $JBOSS_HOME/standalone/deployments/${PWD##*/}.war.dodeploy
}
#Hot deployment to an already deployed JBoss app
#This makes two assumptions.
# 1: you are in the root of your project (where your pom.xml is)
# 2: your working directory is named the same as your project's war
function jboss-hot-deploy() {
#compile the classes
mvn -q compile -DskipTests
#copy to the exploded war on jboss
sudo cp -rf target/classes $JBOSS_HOME/standalone/deployments/${PWD##*/}.war/WEB-INF/
#drop deployment marker so jboss will deploy
sudo touch $JBOSS_HOME/standalone/deployments/${PWD##*/}.war.dodeploy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment