2011-12-31 49 views
21

我有以下的Maven代码段设置“根”与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> 

我想设置上下文路径为“/”,但码头插件不尊重它的上下文路径,上下文下降回到使用文件夹(或者可能是模块)名称作为上下文路径。如果我使用名称设置上下文路径,例如:

<contextPath>/thomas</contextPath> 

有什么建议吗?

在此先感谢。

回答

25

这对我的作品与码头6(版本8和9看到迈克尔·麦卡勒姆的答案):

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

希望它能帮助。

(通常我得到了它提供的赏金!经过短短工作)

+1

我删除了赏金,因为你显然能够找出一些:) – 2012-01-24 10:08:02

+0

抱歉,晚回复,我试过/,但我没有得到它的工作,但如果它在你身边,我可能应该看看是否有其他的东西是错的。 – 2012-02-02 10:34:52

0

它的工作原理!看看这个:

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

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> 
+0

谢谢!他们肯定应该更新jetty-maven-plugin文档! :-) – sergiofbsilva 2013-03-25 20:02:52

+0

对于Jetty 9,它是一样的。 – niels 2014-03-12 09:19:48

+0

你能否提一下如何设置2个上下文路径? – 2016-05-01 10:28:18

3

真正起作用的(当前版本为例):

<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> 
+0

这对码头工作9 – 2016-02-02 06:46:34

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> 
+0

这适用于我 – Harjinder 2015-07-25 19:49:01