title: How can I specify "Context path" on Tomcat 8 inside META-INF/context.xml in java war file?
body: <p>How can I deploy <strong>mywebapp-1.0.0.war</strong> to $TOMCAT_HOME/webapps directory with context path <strong>/mywebapp</strong> using context.xml inside the war file on Tomcat 8? </p>
  
  <p>I'm getting back to work with Tomcat after long time since version 5.   I'm used to create META-INF/context.xml inside my war file: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context path="/mywebapp"&gt;
    ...
  &lt;/Context&gt;
  </code></pre>
  
  <p>Maven creates a war file with this name: mywebapp-1.0.0.war</p>
  
  <p>But when I deploy the war file to $TOMCAT_HOME/webapps directory the context path will be <a href="http://localhost:8080/mywebapp-1.0.0" rel="nofollow noreferrer">http://localhost:8080/mywebapp-1.0.0</a> instead of <a href="http://localhost:8080/mywebapp/" rel="nofollow noreferrer">http://localhost:8080/mywebapp/</a>.</p>
  
  <p>Also I see that $TOMCAT_HOME/conf/Catalina/localhost is empty, instead of having the xml file copied from the war file deployed.</p>
  
  <p>I also added to $TOMCAT_HOME/conf/server.xml the deployXML="true" </p>
  
  <pre><code> &lt;Host name="localhost"  appBase="webapps"
          unpackWARs="true" autoDeploy="true" 
          deployXML="true"&gt;
  </code></pre>