I have created a war file and put into tomcat/webapps
. How to deploy a war file to tomcat using command prompt?
The earlier answers on this page are correct that you can copy/move the WAR file into place and restart tomcat, but they omit to mention something: you must remove the previously exploded assets (from the previously deployed WAR file) if any are present.
# My tomcat webapps are found at /var/lib/tomcat6/webapps
# The application I wish to deploy is the main (ROOT) application
webapps_dir=/var/lib/tomcat6/webapps
# Remove existing assets (if any)
rm -rf $webapps_dir/ROOT
# Copy WAR file into place
cp example_dir/ROOT.war $webapps_dir
# Restart tomcat
service tomcat6 restart
Modify the following for your own system: