简体   繁体   English

避免使用maven-release-plugin更新POM版本以进行下一个开发迭代

[英]Avoid update POM versions for next development iteration with maven-release-plugin

I'm doing my first release with maven-release-plugin and git. 我正在使用maven-release-plugin和git进行第一个发行。 Instead of tagging I'm using the release:branch goal. 我没有标记,而是使用release:branch目标。 I'm agree with the complete relase-flow process except in one point: all local dependencies are automatically updated to the next SNAPSHOT version in the development branch. 我同意完整的发布流程,但要注意的一点是:所有本地依赖项都将自动更新到开发分支中的下一个SNAPSHOT版本。

This is my concrete situation: I'm working in a project with more than 20 maven projects. 这是我的具体情况:我正在一个有20多个Maven项目的项目中工作。 Let's say all of them are in SNAPSHOT version during development. 假设它们在开发过程中均为SNAPSHOT版本。 I want to make a release with the maven plugin. 我想用Maven插件发布。 After the release is done, all POM versions have been incremented and set again to SNAPSHOT. 发行完成后,所有POM版本均已增加,然后再次设置为SNAPSHOT。 If I need to make a change in just one line of code of one project (fix a bug) and I make a new release, all projects (by default) must increment their version again when I've just changed one of them . 如果我只需要在一个项目的一行代码中进行更改(修复错误)并发布新版本,则所有项目(默认情况下)都必须在我刚刚更改其中一个项目时再次增加其版本。

In my opinion, it makes more sense to continue the development with the state of the last release (all version without SNAPSHOT). 我认为,以最新发行版的状态(所有版本均不包含 SNAPSHOT)继续开发会更有意义。 In the next development iteration, I can set manually the next SNAPSHOT version only in these projects that I have changed. 在下一个开发迭代中,我只能在已更改的这些项目中手动设置下一个SNAPSHOT版本。 In the next release, only the changed projects will be "promoted" to a new version but not all of them. 在下一个发行版中,只有更改的项目将被“提升”为新版本,而并非全部。

I think this situation is not exceptional but I didn't found information how to do it (and I don't know if I'm breaking the "release" phylosophy...) 我认为这种情况并不罕见,但是我没有找到有关如何做的信息(而且我不知道我是否正在打破“发行”的思想体系...)

Somedy knows how to avoid update all POMs to the next SNAPSHOT version and leave the POM files as the relase version? Somedy知道如何避免将所有POM更新到下一个SNAPSHOT版本并将POM文件保留为发布版本吗?

Thank you in advance! 先感谢您!

The idea of a multimodule project is that all modules are part of the same release cycle. 多模块项目的想法是,所有模块都是同一发布周期的一部分。 Even is some modules contain no changes, they will be part of the release. 即使某些模块不包含任何更改,它们仍将是发行版的一部分。 As some may say: versions are cheap. 可能有人说:版本很便宜。 The benefits are bigger compared to the ideal picture you described: it is much easier to manage the versions and to control inter-module dependencies. 与您所描述的理想图片相比,其好处更大:管理版本和控制模块间的依赖关系要容易得多。 Keep in mind that both trunk and branches should always have a SNAPSHOT version, since these are the working copies. 请记住,主干和分支都应始终具有SNAPSHOT版本,因为它们是工作副本。 If you use final versions, releases will fail, since you can't tag the same version twice, neither can you deploy(=upload) the same version twice. 如果使用最终版本,则发行将失败,因为您无法两次标记相同的版本,因此也无法两次部署(=上载)相同的版本。 This is very important, because Maven relies on the definition that final versions are immutable, ie Maven will never download a final version again once it is available in the local repository. 这非常重要,因为Maven依赖于最终版本是不可变的定义,即一旦本地存储库中提供了最终版本,Maven就不会再下载最终版本。

So if some modules don't have the same release-cycle as the total multimodule project, you should move them out of this multimodule project (or release them all at once). 因此,如果某些模块的发布周期与整个多模块项目的发布周期不同,则应将其从该多模块项目中移出(或一次全部释放)。

The differences between releasing individual modules, applications or application systems are summarized in my slideshare presentation http://www.slideshare.net/geertpante/version-mgmt-in-maven (slide 20 and following). 我的幻灯片共享演示文稿http://www.slideshare.net/geertpante/version-mgmt-in-maven中总结了发布各个模块,应用程序或应用程序系统之间的差异(幻灯片20及以下)。

What we sometimes do is set the snapshot version to eg 2.0-SNAPSHOT, and do releases as 1.xy So in development, we always keep using 2.0-SNAPSHOT, but when we release, we choose older versions, eg 1.3, 1.4, and choose 2.0-SNAPSHOT as the next release version. 有时我们将快照版本设置为2.0-SNAPSHOT,并以1.xy发行。因此,在开发中,我们始终使用2.0-SNAPSHOT,但是在发行时,我们选择较旧的版本,例如1.3、1.4和选择2.0-SNAPSHOT作为下一个发行版本。

Also, if you use git, take a look at https://bitbucket.org/atlassian/jgit-flow/wiki/Home . 另外,如果您使用git,请查看https://bitbucket.org/atlassian/jgit-flow/wiki/Home One of the advantages is it keeps a single development branch, and only the releases are merged to the master branch: 优点之一是它保留了一个开发分支,并且仅将发行版合并到master分支中:

mvn jgitflow:release-start -DreleaseVersion=1.2 -DdevelopmentVersion=2.0-SNAPSHOT
mvn jgitflow:release-finish -DreleaseVersion=1.2 -DdevelopmentVersion=2.0-SNAPSHOT

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

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