开发者

How to get port number from jetty-maven-plugin?

开发者 https://www.devze.com 2023-03-15 07:55 出处:网络
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? M

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消