Configure the context path of a web app
<p>I am building a java web application using <code>Eclipse</code> and <code>Maven</code>. The app will run on either <code>jboss</code> (<code>wildfly</code>) or <code>tomcat</code>. I would like to configure the context path of my web application. </p>

<p>By default, eclipse sets the context path to be equal to the name of the eclipse project (seen in <code>project -&gt; properties -&gt; web project settings</code>). However, regardless of the context path shown there, when I deploy my war file, the name of the war file is used as the context path, not the setting in eclipse.</p>

<p>I would like to know how to configure the context path in the following three situations:</p>

<ul>
<li>When I run my web project in eclipse, using an embedded server in eclipse (such as tomcat or wildfly). It seems to be taking the project name in this case.</li>
<li>When I build a war (with maven), and run this war file using an embedded server in eclipse. It seems to be taking the name of the war file.</li>
<li>When I build a war and deploy it to an external servlet container (outside of eclipse). It also seems to be taking the war name as context path.</li>
</ul>

<p>Is the context path chosen platform / eclipse / servlet container dependent? Has anybody documented the standard behavior of each container? Is there a way to configure/set the context path for all platforms and servlet containers, regardless of how and where the war is build/deployed, and more importantly, so the war name is NOT the same as the context path?</p>