21

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.

Mike K.
  • 3,581
  • 24
  • 41
Thomas Vervik
  • 3,615
  • 9
  • 32
  • 58

5 Answers5

38

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>
26

This works for me with Jetty 6 (Version 8 and 9 see the answer from Michael McCallum):

           <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.22</version>
                <configuration>
                    <contextPath>/</contextPath>                     
                </configuration>
                ...
            </plugin>

Hope it helps.

(Typically I got it working just after offering the bounty!!)

niels
  • 7,144
  • 2
  • 33
  • 56
laura
  • 2,881
  • 9
  • 40
  • 61
  • 1
    I removed the bounty, because you were obviously able to figure something out :) – Tim Post Jan 24 '12 at 10:08
  • sorry vert late reply, I tried /, but I didnt get it to work, but if it works on your side I maybe should look if there is something else which is wrong. – Thomas Vervik Feb 02 '12 at 10:34
3

Really works (current version example):

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.3.0.M2</version>
    <configuration>
    <webApp>
        <contextPath>/${path}</contextPath>
    </webApp>
    </configuration>
</plugin>
Diana S.
  • 51
  • 1
  • 3
0
  <plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>9.2.11.v20150529</version>
  <configuration>
    <scanIntervalSeconds>10</scanIntervalSeconds>
    <webApp>
         <contextPath>/yourContextPath</contextPath>
    </webApp>    
  </configuration>
  </plugin>
Harjinder
  • 21
  • 6
0

It works! look this :

<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
    <scanIntervalSeconds>10</scanIntervalSeconds>
    <contextPath>/</contextPath>
    <stopKey>foo</stopKey>
    <stopPort>9999</stopPort>
</configuration>
Kjuly
  • 32,573
  • 22
  • 98
  • 112
liang
  • 9
  • 1