简体   繁体   English

为工件 maven jenkins 插件更改部署版本的支持方法是什么

[英]What is the supported way to change version on deploy for artifactory maven jenkins plugin

Im using the maven jfrog plugin: https://jenkins.io/doc/pipeline/steps/artifactory/#rtmavendeployer-set-maven-deployer我正在使用 maven jfrog 插件: https://jenkins.io/doc/pipeline/steps/artifactory/#rtmavendeployer-set-maven-deployer

I want to change the version of the artifact on deploy so it has the feature branch name in it我想在部署时更改工件的版本,以便其中包含功能分支名称

I tried to run the set version goal.我试图运行设定的版本目标。 it succeeds but just totally ignores the version它成功了,但完全忽略了版本

rtMavenRun (
        pom: "pom.xml",
        goals: 'versions:set -DnewVersion=1.2.3-SNAPSHOT clean install',
        resolverId: 'resolver-unique-id',
        deployerId: 'deployer-unique-id'
)

The problem is the following: You call the goal versions:set and the phases clean and install in one Maven run.问题如下:您将目标versions:set和阶段cleaninstall在一次 Maven 运行中。 Before the first goal runs, Maven has already resolved the version for all goals/phases that are run.在第一个目标运行之前,Maven 已经解决了所有运行的目标/阶段的版本。 Therefore, you change the version in the POM, but as Maven has already read it, you will not be able to see it during this run.因此,您更改了 POM 中的版本,但由于 Maven 已经读取它,因此在此运行期间您将无法看到它。

What are possible solutions?有哪些可能的解决方案?

  • You can run versions:set first and then clean install in a separate Maven run.您可以运行versions:set ,然后在单独的 Maven 运行中进行全新clean install
  • You can use the property ${revision} in the definition of <version> and then set this property on the command line.您可以在<version>的定义中使用属性${revision} ,然后在命令行上设置此属性。

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

相关问题 Jenkins Artifactory插件+ Maven Flatten插件+ rtMavenDeployer。 有没有办法部署扁平化的pom文件? - Jenkins Artifactory Plugin + Maven Flatten plugin + rtMavenDeployer. Is there a way to deploy flatten pom files? Artifactory Maven插件无法部署 - Artifactory maven plugin fails to deploy 使用Maven,Jenkins和Artifactory构建一次即可部署到任何地方 - Build Once, Deploy Anywhere, with Maven, Jenkins, and Artifactory 如何使用jenkins将grails二进制插件部署到工件上? - How to deploy a grails binary plugin to artifactory with jenkins? 使Artifactory插件与Jenkins和Maven一起使用 - Getting Artifactory Plugin to work with Jenkins and Maven Jenkins Artifactory插件忽略了Maven UniqueVersion - Jenkins Artifactory Plugin ignoring Maven UniqueVersion Maven 部署插件替换 Artifactory 中现有的快照 Jar - Maven Deploy Plugin Replace the Existing SnapShot Jar in Artifactory 如何在工件参考中部署带有Maven程序集插件的zip文件 - How deploy a zip file whith Maven assembly plugin in the artifactory referentiel Jenkins Artifactory插件在Maven构建期间未检测到我的编译器 - Jenkins Artifactory plugin not detecting my compiler during maven build 从香草Maven切换到Jenkins Artifactory插件后出现“未授权”错误 - 'Not authorized' errors after switching from vanilla Maven to Jenkins Artifactory Plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM