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

Jenkins maven-release-plugin -D properties using in the pom

如何在 Jenkins 中执行发布时在 pom.xml 中使用 -D 参数? mvn --help 说:

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

但是如果我使用-D 属性作为系统变量,sys.someProperty,它是不可见的。

示例:pom.xml: ...

<properties>
    <jira.password>${sys.password}</jira.password>
</properties>

命令:

mvn -B -f pom.xml -DdevelopmentVersion=2.5-SNAPSHOT -DreleaseVersion=2.4 -Dusername=ivan -Dresume=false release:prepare release:perform -Dpassword=*********

当您使用 maven-release-plugin, the system arguments must be written in the arguments 系统时 属性。这是因为发布是在分叉的 Maven 实例中执行的,因此之前设置的系统属性丢失了。

发布期间跳过测试的示例:

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