问题描述
文档说明您是否在此处有上下文文件:
Documentation says if you have a context file here:
$CATALINA_HOME/conf/Catalina/localhost/myapp.xml
这里不会被上下文文件替换:
it will NOT be replaced by a context file here:
mywebapp.war/META-INF/context.xml
写在这里:http://tomcat.apache/tomcat-6.0-doc/config/context.html
仅当 $CATALINA_BASE/conf/[enginename]/[hostname]/中的应用程序的上下文文件不存在时,应用程序文件中/META-INF/context.xml 的单个文件中.
Only if a context file does not exist for the application in the $CATALINA_BASE/conf/[enginename]/[hostname]/, in an individual file at /META-INF/context.xml inside the application files.
但每次我重新部署战争时,它都会用/META-INF/context.xml 替换这个 myapp.xml!
But everytime I re-deploy the war it replaces this myapp.xml with the /META-INF/context.xml!
为什么会这样,我该如何避免?
Why does it do it and how can I avoid it?
谢谢
推荐答案
重新部署的取消部署部分会删除应用程序和关联的 context.xml.
Undeploy part of redeploy deletes app and the associated context.xml.
如果你使用 maven tomcat 插件,你可以避免删除 context.xml,如果你使用这样的命令部署你的应用程序:
If you use maven tomcat plugin you can avoid deleting context.xml if you deploy your app with command like this:
mvn tomcat:deploy-only -Dmaven.tomcat.update=true
更多信息在这里:https://tomcat.apache/maven-plugin-2.0-beta-1/tomcat7-maven-plugin/deploy-only-mojo.html
您也可以使用带参数模式的 deploy-only 来部署 context.xml.
You can use deploy-only with parameter mode to deploy the context.xml too.
这篇关于为什么tomcat在重新部署时替换context.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论