Reputation: 4545
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.
Upvotes: 21
Views: 21698
Reputation: 21
<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>
Upvotes: 0
Reputation: 51
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>
Upvotes: 3
Reputation: 2961
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!!)
Upvotes: 26
Reputation: 451
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>
Upvotes: 42
Reputation: 9
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>
Upvotes: 0