简体   繁体   English

Jenkins maven-release-plugin -D 属性在 pom 中使用

[英]Jenkins maven-release-plugin -D properties using in the pom

How to use -D argument in the pom.xml when performing a release in Jenkins?在 Jenkins 中执行发布时如何在pom.xml使用-D参数? mvn --help say: mvn --help说:

-D,--define <arg>                      Define a system property

But if I use -D property as system variable, sys.someProperty , it is not visible.但是如果我使用-D属性作为系统变量, sys.someProperty ,它是不可见的。

Example: pom.xml : ...示例: 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=*********

When you are using the maven-release-plugin , the system arguments must be written in the arguments system property.当您使用maven-release-plugin ,系统参数必须写入arguments系统属性中。 This is because the release is performed in a forked Maven instance so system properties set before are lost.这是因为发布是在分叉的 Maven 实例中执行的,因此之前设置的系统属性丢失了。

Example to skip the tests during release:在发布期间跳过测试的示例:

mvn -B release:prepare -Darguments="-DskipTests=true"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM