tags:

views:

98

answers:

1

Hi.

I'm working on an integration test suite and I've got a question for you.

My parent pom defines the use of the jetty plugin with the goal: run-war. I need to make the port that jetty listens on changeable via the command-line. This can be achieved by passing -Djetty.port=8099 for example.

In the child project, I need to use this port number to configure the endpoint for some SOAP tests that I'll need to run on the service hosted by jetty.

If I use ${jetty.port} in my child pom in the end-point configuration this works fine IF and only IF I explicitly pass -Djetty.port when invoking maven.

In my child pom:


<endpoint>http://127.0.0.1:${jetty.port}/{artifactId}&lt;endpoint>

I need jetty.port to be filled in with 8080 which is what jetty defaults to if -Djetty.port is not explicitly passed, and still catch any other port values if the command line argument is specified.

+2  A: 

Use the properties section, and add a jetty.port property with a default value:

<properties>
  <jetty.port>8080</jetty.port>
</properties>
Robert Munteanu
Thank you. That wasn't too hard :-) I'll accept this post as an answer as soon as the timer runs out.
John