Ich habe das folgende 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>
Ich möchte den Kontextpfad auf "/" setzen, aber das Jetty-Plugin beachtet dies nicht. Der Kontext wird zurückgesetzt, indem der Ordnername (oder möglicherweise der Modulname) als Kontextpfad verwendet wird. Wenn ich einen Kontextpfad mit einem Namen festlege, zum Beispiel:
<contextPath>/thomas</contextPath>
Irgendwelche Vorschläge?
Danke im Voraus.
Dies funktioniert für mich mit Jetty 6 (Version 8 und 9 siehe die Antwort von Michael McCallum):
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<contextPath>/</contextPath>
</configuration>
...
</plugin>
Ich hoffe es hilft.
(Normalerweise habe ich es gleich nach dem Angebot der Prämie zum Laufen gebracht !!)
FWIW das ist was du für jetty 8 brauchst
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
Funktioniert wirklich (aktuelles Versionsbeispiel):
<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>
Es klappt! Sieh dir das an :
<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>
<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>