brain storm
brain storm

Reputation: 31252

how is the properties set in this pom.xml?

This is the snippet of pom.xml from my project.

<properties>
        <Port>2020</Port>   
        <threads>20</threads>
        <test.suite />
        <test.suite.path />
        <useTag />
        <useTestCase />
        <args>-Dthreads=${threads} -Dtest.suite.path=${test.suite.path} -Dappenv=${test.app.env} -Dtest.suite=${test.suite} -DuseTag=${useTag} -DuseTestCase=${useTestCase}</args>
    </properties>

when maven build is made, I am wondering how the variables test.suite, test.suite.path, useTestCase are set? I do not see it anywhere in the pom. but the Jenkins build is working fine and it has substituted values for these placeholders.

what is the use of using this kind of property setting. <variable/> rather than <variable>...</variable> ?

Upvotes: 1

Views: 99

Answers (1)

K Erlandsson
K Erlandsson

Reputation: 13696

To say exactly how those properties are set in your case we need to see the entire pom structure including the parent pom(s) as well as your Jenkins job configuration.

However, I know of two ways that these properties can be set:

  1. Through a profile in one of your parent poms

  2. Through system properties when maven is invoked

My guess is that you have a profile in one of your parents that sets these properties. Something like this:

<profile>
      <id>jenkins</id>
      <properties>
           <test.suite>...</test.suite>
           ...
      </properties>
</profile>

And that this profile is activated on your Jenkins server. Look here for information how the profile can be activated.

The other option is that these properties are specified as system properties when maven is invoked from Jenkins.

As for why <variable/> is used over <variable></variable> it is a matter of taste. <variable/> means the same thing as <variable></variable> in XML.

Upvotes: 1

Related Questions