Maven Jetty插件stopPort和stopKey丢失或无效

时间:2013-12-16 14:02:28

标签: java maven maven-jetty-plugin

我正在学习Maven并遇到了问题。当我尝试使用我的webapp进行mvn clean install时,我得到错误,说参数stopPort和stopKey丢失或无效。这是pom.xml的样子:

    <plugin>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>maven-jetty-plugin</artifactId>
       <version>6.1.17</version>
       <executions>
         <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <scanIntervalSeconds>0</scanIntervalSeconds>
              <stopPort>9999</stopPort>
              <stopKey>foo</stopKey>
              <daemon>true</daemon>
            </configuration>
         </execution>
         <execution>
            <id>stop-jetty</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
         </execution>
       </executions>
    </plugin>

知道是什么原因引起的吗? Thx提前。

1 个答案:

答案 0 :(得分:7)

问题是您只在stopPort目标中定义了stopKeyrun配置。需要将此配置移至execution部分之外。

所以你的pom现在是:

<plugin>
   <groupId>org.mortbay.jetty</groupId>
   <artifactId>maven-jetty-plugin</artifactId>
   <version>6.1.17</version>
   <configuration>
       <scanIntervalSeconds>0</scanIntervalSeconds>
       <stopPort>9999</stopPort>
       <stopKey>foo</stopKey>
   </configuration>
   <executions>
     <execution>
        <id>start-jetty</id>
        <phase>pre-integration-test</phase>
        <goals>
          <goal>run</goal>
        </goals>
        <configuration>
          <daemon>true</daemon>
        </configuration>
     </execution>
     <execution>
        <id>stop-jetty</id>
        <phase>post-integration-test</phase>
        <goals>
          <goal>stop</goal>
        </goals>
     </execution>
   </executions>
</plugin>