简体   繁体   中英

Maven Jetty plugin stopPort and stopKey missing or invalid

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM