How to get port number from jetty-maven-plugin?
jetty-maven-plugin 7.x, when used in integration 开发者_JS百科testing, dynamically finds available port, in runtime. How can I save the number of the port found and use it in Java integration tests? Maybe jetty-maven-plugin can save it into a system variable?
This is how it works:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<portNames>
<portName>jetty.port</portName>
<portName>jetty.port.stop</portName>
</portNames>
</configuration>
<executions>
<execution>
<id>reserve-port</id>
<phase>pre-integration-test</phase>
<goals>
<goal>reserve-network-port</goal>
</goals>
</execution>
</executions>
</plugin>
Then ${jetty.port}
can be used for jetty plugin.
精彩评论