为什么tomcat在redeploy上替换context.xml? [英] Why does tomcat replace context.xml on redeploy?
问题描述
文档说如果你有一个上下文文件:
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.org/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?
Thanx
推荐答案
取消部署重新部署删除应用程序和相关的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
更多信息: http ://mojo.codehaus.org/tomcat-maven-plugin/deploy-only-mojo.html
您可以使用仅部署参数模式来部署context.xml。
You can use deploy-only with parameter mode to deploy the context.xml too.
这篇关于为什么tomcat在redeploy上替换context.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!