Nexus Artifacts Uploading

后端 未结 1 1824
孤独总比滥情好
孤独总比滥情好 2021-01-29 12:09

How to upload artifacts to nexus with auto generating the version by using jenkins shell? I am using this script and I want to generate the version automatically when artifact u

相关标签:
1条回答
  • 2021-01-29 12:55

    You can use ${env.BUILD_NUMBER} variable in your Jenkins pipeline to specify the artifact version.

    To do this there are few options:

    1. If you want to publish artifacts to Nexus during mvn deploy, then you can use ${revision} parameter in pom.xml file. To do this, you need to put this variable into <version> tag. E.g., <version>1.0-${revision}</version> and then provide it to the maven command in Jenkins pipeline: mvn deploy -Drevision=${env.BUILD_NUMBER}. See this answer for details.
    2. Also you can use Nexus Jenkins Plugin to upload artifacts to nexus and specify the artifact version using ${env.BUILD_NUMBER} variable. See this for details.
    0 讨论(0)
提交回复
热议问题