Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

deployment - 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

It is written here: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

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.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Undeploy part of redeploy deletes app and the associated 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

More info here: https://tomcat.apache.org/maven-plugin-2.0-beta-1/tomcat7-maven-plugin/deploy-only-mojo.html

You can use deploy-only with parameter mode to deploy the context.xml too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...