使用Maven Jetty插件设置"root"上下文路径

Tho*_*vik 21 maven-jetty-plugin

我有以下Maven代码段

<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>
Run Code Online (Sandbox Code Playgroud)

我想将上下文路径设置为"/"但Jetty插件不尊重它,上下文回退到使用文件夹(或可能是模块)名称作为上下文路径.如果我使用名称设置上下文路径,例如:

 <contextPath>/thomas</contextPath>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

提前致谢.

Mic*_*lum 38

FWIW这是你需要的码头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>
Run Code Online (Sandbox Code Playgroud)

  • 对于Jetty 9来说它是一样的. (2认同)

lau*_*ura 26

Jetty 6(版本8和9见Michael McCallum的回答)对我有用:

           <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.22</version>
                <configuration>
                    <contextPath>/</contextPath>                     
                </configuration>
                ...
            </plugin>
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你.

(通常我在提供赏金之后才开始工作!!)