I have my "finalName" and the build-helper-maven-plugin configured like this in my main module :
我有我的“finalName”和build-helper-maven-plugin在我的主模块中配置如下:
<build>
<finalName>${project.artifactId}_${build.time}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>timestamp-property</id>
<goals>
<goal>timestamp-property</goal>
</goals>
<configuration>
<name>build.time</name>
<pattern>yyyy-MM-dd.HHmm</pattern>
<locale>fr_FR</locale>
<timeZone>Europe/Paris</timeZone>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
It works fine when I use "mvn package" on the aggregator, but if I do "mvn deploy", it's just ignored : the artifacts use a pattern similar to version_artifactId_maven-timestamp (maven-timestamp using UTC). Also the "version" used in the uploaded artifact is "1.0.0-SNAPSHOT" when the only version I have is in the parent and is "1.0.0-CD".
当我在聚合器上使用“mvn package”时它工作正常,但是如果我执行“mvn deploy”,它就会被忽略:工件使用类似于version_artifactId_maven-timestamp的模式(使用UTC的maven-timestamp)。当我唯一拥有的版本是“1.0.0-CD”时,上传工件中使用的“版本”是“1.0.0-SNAPSHOT”。
How can I solve this ?
我怎么解决这个问题?
P.S. : all these tests are local, not using some CI server yet.
附: :所有这些测试都是本地的,而不是使用某些CI服务器。
P.P.S. : I have to say only artifacts uploaded to Artifactory have wrong names, the artifacts in my target directories are fine.
P.P.S. :我不得不说只有上传到Artifactory的工件有错误的名字,我目标目录中的工件都没问题。
1 个解决方案
#1
0
No answer so far, so here is how I solved this problem.
到目前为止还没有答案,所以这就是我如何解决这个问题。
I'm using the possibility offered by Maven (without any warning from Maven v3.2.1) to set the version of a pom externally : Allow continuous delivery friendly versions.
我正在使用Maven提供的可能性(没有Maven v3.2.1的任何警告)从外部设置pom的版本:允许持续交付友好版本。
So I replace every <version>1.0.0-SNAPSHOT</version>
occurences in aggregator, parent, module (including dependencies) by <version>${revision}</version>
.
所以我用
And to setup my timezoned timestamp in my release version, I use the "BUILD TIMESTAMP plugin" from Jenkins.
要在我的发布版本中设置我的timezoned时间戳,我使用Jenkins的“BUILD TIMESTAMP插件”。
So the maven deploy command line in jenkins becomes in "Build > Goals and options" : deploy scm:tag -Drevision=1.0.0_$BUILD_TIMESTAMP
所以jenkins中的maven deploy命令行变为“Build> Goals and options”:deploy scm:tag -Drevision = 1.0.0_ $ BUILD_TIMESTAMP
No offense to @khmarbaise, most credits to : Maven Release Plugin: Dead and Buried
没有冒犯@khmarbaise,大多数信用:Maven Release Plugin:Dead and Buried
#1
0
No answer so far, so here is how I solved this problem.
到目前为止还没有答案,所以这就是我如何解决这个问题。
I'm using the possibility offered by Maven (without any warning from Maven v3.2.1) to set the version of a pom externally : Allow continuous delivery friendly versions.
我正在使用Maven提供的可能性(没有Maven v3.2.1的任何警告)从外部设置pom的版本:允许持续交付友好版本。
So I replace every <version>1.0.0-SNAPSHOT</version>
occurences in aggregator, parent, module (including dependencies) by <version>${revision}</version>
.
所以我用
And to setup my timezoned timestamp in my release version, I use the "BUILD TIMESTAMP plugin" from Jenkins.
要在我的发布版本中设置我的timezoned时间戳,我使用Jenkins的“BUILD TIMESTAMP插件”。
So the maven deploy command line in jenkins becomes in "Build > Goals and options" : deploy scm:tag -Drevision=1.0.0_$BUILD_TIMESTAMP
所以jenkins中的maven deploy命令行变为“Build> Goals and options”:deploy scm:tag -Drevision = 1.0.0_ $ BUILD_TIMESTAMP
No offense to @khmarbaise, most credits to : Maven Release Plugin: Dead and Buried
没有冒犯@khmarbaise,大多数信用:Maven Release Plugin:Dead and Buried