Reputation: 31252
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
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:
Through a profile in one of your parent poms
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