Setting "root" context path with Maven Jetty plugin

Thomas Vervik picture Thomas Vervik · Dec 31, 2011 · Viewed 20.7k times · Source

I have the following Maven code snippet

<plugin>
  <!-- http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin -->
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>maven-jetty-plugin</artifactId>
  <version>6.1.16</version>
  <configuration>
    <contextPath>/thomas</contextPath>
    <stopPort>9966</stopPort>
    <stopKey>foo</stopKey>
  </configuration>
</plugin>

I want to set context path to "/" but the Jetty plugin doesn't respect it, the context falls back to using the folder (or maybe the module) name as the context path. If I set a context path with a name, for example:

 <contextPath>/thomas</contextPath>

Any suggestions?

Thanks in advance.

Answer

Michael McCallum picture Michael McCallum · Nov 4, 2012

FWIW this is what you need for jetty 8

<plugin>
 <groupId>org.mortbay.jetty</groupId>
 <artifactId>jetty-maven-plugin</artifactId>
 <version>8.1.7.v20120910</version>
 <configuration>       
   <webApp>
    <contextPath>/</contextPath>
  </webApp>
 </configuration>
</plugin>