简体   繁体   English

使用Maven / Jenkins / Git创建发布标签

[英]Creating release tag with Maven/Jenkins/Git

I'm using Jenkins,GIT and Maven as part of my development process. 在开发过程中,我正在使用Jenkins,GIT和Maven。 I have two branches develop and master. 我有两个分支机构发展和掌握。 As usual i do my development on develop, test it and merge it to master for the jar to be published. 像往常一样,我在开发上进行开发,测试并将其合并为要发布的jar的母版。

I'm using Jenkins to deploy my snapshots/release jars to our Nexus repository. 我正在使用Jenkins将快照/发布jar部署到我们的Nexus存储库。 When i deploy/publish the release jar (one without -SNAPSHOT) i would like to create a release TAG in my github repo, while i want to avoid that while deploying my snapshots. 当我部署/发布发布jar(一个没有-SNAPSHOT的发布)时,我想在我的github存储库中创建一个发布TAG,而我想在部署快照时避免这种情况。

I went through the posts at http://www.dev9.com/article/2014/9/java-release-process-with-continuous-delivery and https://axelfontaine.com/blog/final-nail.html to get some idea. 我浏览了http://www.dev9.com/article/2014/9/java-release-process-with-continuous-deliveryhttps://axelfontaine.com/blog/final-nail.html上的帖子有一些想法。

My questions are the following: 我的问题如下:

  • Do i need to keep two different Jenkins job for my develop and master branches? 我需要为开发分支和主分支保留两个不同的Jenkins工作吗? The one for master will have the configuration with maven-scm-plugin and maven-version-plugin to create the tag. 主服务器将使用maven-scm-plugin和maven-version-plugin进行配置以创建标签。
  • Do I need to remove the '-SNAPSHOT' from the version in pom.xml of my master branch? 我是否需要从我的master分支的pom.xml中的版本中删除“ -SNAPSHOT”? I know the scm plugin will remove those while creating the tag, but i suppose maven will publish/deploy the jar with '-SNAPSHOT'? 我知道scm插件将在创建标签时将其删除,但是我想maven将使用'-SNAPSHOT'发布/部署jar? While running the Jenkins job for my master branch, i would like to deploy 1.0.0.jar and not 1.0.0-SNAPSHOT. 在为我的master分支运行Jenkins作业时,我想部署1.0.0.jar而不是1.0.0-SNAPSHOT。

Basically you need the following plugin : http://maven.apache.org/maven-release/maven-release-plugin/ 基本上,您需要以下插件: http : //maven.apache.org/maven-release/maven-release-plugin/

The plugin do the following : 该插件执行以下操作:

  • 1) remove the -SNAPSHOT, and commit 1)删除-SNAPSHOT,然后提交
  • 2) Tag the version in git, commit 2)在git中标记版本,提交
  • 3) Increment the version number and add -SNAPSHOT, commit 3)增加版本号并添加-SNAPSHOT,提交
  • 4) Push those change 4)推动那些改变

What it look like in jenkins (configuration of the job) jenkins的外观(作业配置) 詹金斯

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM