I am learning Maven and have encountered a problem. When I try to do mvn clean install with my webapp i get the error saying that parameters stopPort and stopKey are missing or invalid. Here is what pom.xml looks like:

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

Any idea what could cause that? Thx in advance.

有帮助吗?

解决方案

The problem is that you have only defined the stopPort and stopKey configuration in the run goal. This configuration needs to be moved to be outside the execution section.

So your pom would now be:

<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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top