我正在尝试为具有两个分支的项目统一两个 CI 配置文件。master
分支包含每晚构建一次的生产分支,分支dev
包含开发分支。
为了自动化-SNAPSHOT
DEV 分支上的后缀,我应用了以下 POM。
<version>1.1.11${build.suffix}</version>
<properties>
<build.suffix>-SNAPSHOT</build.suffix>
</properties>
然后我有两个构建配置,一个在 jenkins 中-Dbuild.suffix=".$BUILD_NUMBER"
分配给prod MAVEN_OPTS
,但 maven 似乎总是在没有后缀的情况下构建,并且总是放在-SNAPSHOT
每个构建的末尾。
在本地运行它工作正常,即
mvn -Dbuild.suffix=".123" clean package
工作正常。
我也收到以下警告,有没有更好的方法来做我想做的事情?
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.johnsands:unite:war:1.1.11-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ com.johnsands:unite:1.1.11${build.suffix}, /Users/bryan/Development/unite/pom.xml, line 11, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]