accessing dynamic port with gmaven plugin

84 Views Asked by At

I am starting up my app during the pre-integration-test phase on a dynamic reserved port. I am using the GMaven plugin and Failsafe to issue a REST call to ensure a successful deployment before proceeding with the tests. However the port number is still coming back as null. I set the portNum to the Maven environment variable:

  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
            <systemPropertyVariables>
                <testPort>${portNum}</testPort>
            </systemPropertyVariables>
        </configuration>
        <executions>
            <execution>
                <phase>pre-integration-test</phase>
            </execution>
        </executions>
    </plugin>

But when reading the port in the Groovy script I still get null:

port = System.getProperty("testPort").toString()
uri = "http://localhost:" + port
log.info(uri)

--> http://localhost:null

Any ideas are appreciated.

Regards

0

There are 0 best solutions below