Setting "root" context path with Maven Jetty plugin
20,924
Solution 1
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!!)
Solution 2
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>
Solution 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>
Comments
-
Thomas Vervik almost 4 years
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.
-
Tim Post over 12 yearsI removed the bounty, because you were obviously able to figure something out :)
-
Thomas Vervik over 12 yearssorry vert late reply, I tried <contextPath>/</contextPath>, 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.
-
sergiofbsilva over 11 yearsThanks! They should definitely update the jetty-maven-plugin docs! :-)
-
niels over 10 yearsFor Jetty 9 it is the same.
-
Débora about 8 yearsCan you please mention how to set 2 context paths ?
-
Jaraws over 2 yearsCan we give this context path via system property? like -Djetty.port=XXXX