[英]Maven versioning and release GIT repository
I have a multiple maven projects in a single GIT repository .I wanted to perform individual release for the maven projects,push the release version to nexus, skip the tagging and increment the snapshot and commit. 我在单个GIT存储库中有多个maven项目。我想为maven项目执行单独的发布,将发布版本推到nexus,跳过标记并增加快照并提交。
Maven release goal used 使用的Maven发布目标
release:clean release:prepare release:perform
Maven Release plugin : Maven Release插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.releaseplugin.version}</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>releases</releaseProfiles>
</configuration>
</plugin>
Since the tagging happens to a repository i wanted to skip the tagging in GIT.We will do the tagging manually during code freeze window. 由于标记发生在存储库中,因此我想跳过GIT中的标记。我们将在代码冻结窗口期间手动进行标记。
I would to avoid creating individual repository for the maven projects. 我要避免为Maven项目创建单独的存储库。
Can you please tell me how can i acheive it in better way. 你能告诉我如何更好地实现它吗?
I would also like to understand how it is managed in other companies. 我还想了解其他公司如何对其进行管理。
The best (easiest and robust) way that I think is available with Maven & Nexus is: 我认为Maven和Nexus可以使用的最佳(最简单,最可靠)方法是:
VERSION=`mvn help:evaluate -Dexpression=project.version | grep -v "^\\["| grep -v Download` VERSION=${VERSION/%-SNAPSHOT/} #get rid of -SNAPSHOT if it's there VERSION="$VERSION-"`date +"%Y%m%d.%H%M%S"`"-$BUILD_NUMBER" mvn versions:set -DnewVersion=$VERSION
Pros: 优点:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.