Java – Where to put context.xml with Eclipse WTP

eclipseeclipse-wtpjava

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

Best Answer

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.