Maven Jetty plugin stopPort and stopKey missing or invalid
Asked Answered
D

1

5

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.

Demetrademetre answered 16/12, 2013 at 14:2 Comment(3)
This is pretty much a guess, but could the problem be because your stopPort and stopKey are only contained in the configuration of the run goal? If you moved that configuration to before the executions section does it work? An example can be seen here: docs.codehaus.org/display/JETTY/…Cafeteria
Awww.. how I could have missed that! Worked fine - thank you! +1Demetrademetre
Glad to hear it worked. Have added it as a proper answer, so that others can easily find it, should they run into the same problem.Cafeteria
C
7

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>
Cafeteria answered 16/12, 2013 at 15:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.