Where to put context.xml with Eclipse WTP?

2019-02-22 09:59发布

问题:

I'm using Eclipse Indigo 3.7 + WTP + m2e (including m2e-wtp). I've configured my Tomcat 7.0 server on Eclipse. I have a web application that I'm trying to run on Tomcat through Eclipse, but when I run it, the context.xml file is not copied to the conf/Catalina/localhost directory and this causes some issues to my app.

Where the context.xml should be put in order to be copied to this directory?

Thanks

回答1:

If you need to specify a context.xml file when deploying a WAR file to Tomcat, then it must be included within the WAR. The simplest way to achieve this is by adding it to your webapp resources:

src
|_ main
   |_ webapp
      |_ META-INF
         |_ context.xml

When You will build your web app (*.war) maven will join it to WAR in suitable place.