home | codereading | contact | github | math | misc | notes | patches | tech | README

Tomcat notes

Deployment of a web application (WAR) in Tomcat

A quick way to deploy an application in Tomcat is just to follow the tip of this jGuru.com FAQ entry.

  1. Stop Tomcat
  2. Delete existing deployments (directories of your WAR file).
  3. Copy WAR file to the webapps directory in Tomcat.
  4. Start Tomcat

This quick-n-dirty script does that:


set -x

export CATALINA_HOME=<your Tomcat installation>


jar cvf ${app}.war ${app}
sh shutdown.sh
cd -
rm -rf ${CATALINA_HOME}/webapps/${app}
mv ${app}.war ${CATALINA_HOME}/webapps/
sh startup.sh

Just call it, passing your web application directory as the first parameter:

$ deploy-war.sh mywebapp/