简体   繁体   中英

How to configure tomcat to redeploy war every time?

I added following setting in tomcat's configuration file server.xml.

<Context docBase="path/to/war/abc.war" path="abc"/>

Startup tomcat, tomcat will unpack abc.war to webapps/abc.

Then I use build tools to generate new version of abc.war, new abc.war will overwrite old abc.war file.

Stop tomcat, restart it again. New abc.war is not get deployed. Is there a configuration for tomcat to redeploy war files every time?

Although, There is a workaround, delete webapps/abc folder every time before starting up tomcat.

Set unpackWar=true in the context.xml

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Auto deploy feature of Tomcat should setup at Host configuration, for axample

<Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">

Read more at this link Tomcat Automatic_Application_Deployment

<Context docBase="path/to/war/abc.war" path="abc" unpackWar="false"/>

I added unpackWar="false" in Context tag. This property will let Tomcat deploy the war file every time in my environment. This will deploy the application in ${TOMCAT_HOME}/work folder instead of $(TOMCAT_HOME}/webapps folder.

It works for me. By the way I am using Tomcat-7.0.56.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM