Reputation: 4086
How to use -D
argument in the pom.xml
when performing a release in Jenkins?
mvn --help
say:
-D,--define <arg> Define a system property
But if I use -D
property as system variable, sys.someProperty
, it is not visible.
Example: pom.xml
:
...
<properties>
<jira.password>${sys.password}</jira.password>
</properties>
Command:
mvn -B -f pom.xml -DdevelopmentVersion=2.5-SNAPSHOT -DreleaseVersion=2.4 -Dusername=ivan -Dresume=false release:prepare release:perform -Dpassword=*********
Upvotes: 4
Views: 1013
Reputation: 137309
When you are using the maven-release-plugin
, the system arguments must be written in the arguments
system property. This is because the release is performed in a forked Maven instance so system properties set before are lost.
Example to skip the tests during release:
mvn -B release:prepare -Darguments="-DskipTests=true"
Upvotes: 6