简体   繁体   English

Maven相同的聚合器和父级(相同的pom)。 独立子模块版本

[英]Maven same aggregator and parent (same pom). Independent sub-modules versions

I started reading about good practices related to multi-module maven projects, specifically about the advice to use separate pom aggregators and parents. 我开始阅读有关多模块Maven项目的良好实践,特别是有关使用单独的pom聚合器和父级的建议。 I found this site which contains the following paragraph: 我发现此网站包含以下段落:

What you can see in the module POMs example is that it inherits its version from the parent POM. 您可以在模块POMs示例中看到的是,它从父POM继承了其版本。 This is quite natural for small to medium sized projects. 对于中小型项目来说,这是很自然的。 The team makes code changes on every module for the next release. 团队将在每个模块上更改代码以用于下一个版本。

You may use different versions for your modules, but this will not take you very far. 您可以为模块使用不同的版本,但这不会使您走得太远。 If you release the project via its aggregate parent POM, all modules will get released, with their individual version. 如果通过聚合的父POM释放项目,则所有模块及其各自的版本都将被释放。 That's fine – at first thought. 很好–乍一想。 If you look closer you will notice that the version will increase, even if some of the modules have not any changes at all. 如果您仔细看,您会发现版本会增加,即使某些模块根本没有任何更改。 With this approach, having a multi-module aggregate parent POM using different versions for each submodule, you only have the flexibility to decide, if a new version is major, minor or micro . 使用这种方法,如果每个子模块都有一个使用不同版本的多模块聚合父POM,则您只能灵活地确定新版本是main,minor还是micro But is this worth the effort? 但这值得付出努力吗?

As far as I know, when you run the release plugin, it will ask for the new versions of each sub-module. 据我所知,当您运行发布插件时,它将要求每个子模块的新版本。 If there were no changes made to a particular sub-module, you can decide not to bump its version. 如果未对特定子模块进行任何更改,则可以决定不更改其版本。

What did the author mean? 作者是什么意思?

在该段中,作者打算强调一个事实,即您无法决定不构建子模块,您唯一可以控制的就是新的开发版本。

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

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