简体   繁体   English

如何配置tomcat每次重新部署战争?

[英]How to configure tomcat to redeploy war every time?

I added following setting in tomcat's configuration file server.xml. 我在tomcat的配置文件server.xml中添加了以下设置。

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

Startup tomcat, tomcat will unpack abc.war to webapps/abc. 启动tomcat,tomcat会将abc.war解压缩到webapps / abc。

Then I use build tools to generate new version of abc.war, new abc.war will overwrite old abc.war file. 然后,我使用构建工具生成新版本的abc.war,新的abc.war将覆盖旧的abc.war文件。

Stop tomcat, restart it again. 停止tomcat,然后重新启动。 New abc.war is not get deployed. 未部署新的abc.war。 Is there a configuration for tomcat to redeploy war files every time? Tomcat是否有配置可以每次重新部署War文件?

Although, There is a workaround, delete webapps/abc folder every time before starting up tomcat. 尽管有一种解决方法,但是每次启动tomcat之前都要删除webapps / abc文件夹。

Set unpackWar=true in the context.xml 在context.xml中设置unpackWar = true

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

Auto deploy feature of Tomcat should setup at Host configuration, for axample Tomcat的自动部署功能应在主机配置中设置(例如)

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

Read more at this link Tomcat Automatic_Application_Deployment 在此链接中了解更多信息Tomcat Automatic_Application_Deployment

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

I added unpackWar="false" in Context tag. 我在Context标签中添加了unpackWar="false" This property will let Tomcat deploy the war file every time in my environment. 此属性将使Tomcat每次在我的环境中部署war文件。 This will deploy the application in ${TOMCAT_HOME}/work folder instead of $(TOMCAT_HOME}/webapps folder. 这会将应用程序部署在$ {TOMCAT_HOME} / work文件夹中,而不是$(TOMCAT_HOME} / webapps文件夹中。

It works for me. 这个对我有用。 By the way I am using Tomcat-7.0.56. 顺便说一句,我正在使用Tomcat-7.0.56。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何无缝地在Tomcat中重新部署战争? - How to redeploy a war in tomcat seamlessly? 如何在不删除/取消部署旧应用程序的情况下在tomcat中重新部署war文件? - How to redeploy war file in tomcat without deleting/undeploy the old application? 重新部署战争时是否需要重新启动tomcat? - Is it necessary to restart tomcat when redeploy a war? 重新部署tomcat Live生产服务器的战争 - Redeploy war on tomcat live productive server 如何使用maven-tomcat7-plugin在Tomcat上适当地热部署/重新部署战争? - How to properly hot deploy/redeploy war on Tomcat with maven-tomcat7-plugin? 如何为tomcat配置maven-war-plugin - How configure maven-war-plugin for tomcat 每次重新启动tomcat服务时是否都需要部署war文件 - Is it necessary to deploy the war files every time the tomcat service is restarted 如何重新部署运行在Tomcat上的一类Web应用程序? - How to redeploy one class of webapp running on tomcat? Apache Tomcat6:是否可以自动检测战争的新版本,下载并重新部署? - Apache Tomcat6: Is it possible to auto detect a new version of a war, download and redeploy? 如何在不影响Tomcat的情况下替换已编译jar中的文件 - How to replace file in compiled jar without affectig Tomcat redeploy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM