从多模块项目发布 bom [英] Publish a bom from a multi-module-project

查看:97
本文介绍了从多模块项目发布 bom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是一家拥有大约 2000 个独立 Java 项目的大公司.由于历史原因,我们没有多模块项目,但我们想介绍一下.

We are a large company with about 2000 separate Java projects. For historic reasons, we do not have multi-module projects, but we would like to introduce them.

从逻辑上讲,我们已经有了项目组",即有人负责(比如)50 个密切相关的项目.这个人定期发布一个 BOM,其中包含这 50 个项目的最新、连贯的版本.

Logically, we already have "groups" of projects, i.e. someone responsible for (say) 50 projects which are closely related. This someone regularly publishes a BOM which contains recent, coherent versions of these 50 projects.

现在抓住这 50 个项目并将它们放入一个大型多模块项目中会很有意义.尽管如此,还是有必要发布 BOM,因为其他项目(我们组之外的)应该有一致的版本.

Now it would make a lot of sense to grab these 50 projects and put them into one large multi-module project. Still, it would be necessary to publish a BOM because other projects (outside our group) should have coherent versions.

总而言之,我们需要一个 BOM,其中包含作为多模块项目一部分的所有 50 个项目的版本.我想知道创建这样一个 BOM 的Maven 方式"是什么.我能想到的:

So, summarised, we need a BOM that contains the versions of all 50 projects that are part of the multi-module project. I wonder what would be the "Maven way" to create such a BOM. What I can think of:

  • bom 是多模块项目的第 51 个项目.依赖项的版本由父 pom 中的属性设置.
  • bom 是根据多模块项目中存在的信息生成的,并作为副工件发布(这可能需要我们为此编写 Maven 插件).

什么是可取的?

推荐答案

我们也将 BOM 用于我们的多模块项目,但我们不会将它们的生成或更新与这些模块的构建联系起来.

We are using BOMs as well for our multi-modules projects, but we are not tying their generation or update to the build of those modules.

只有当我们的发布管理流程完成构建模块(或模块组)的交付时,才会更新 BOM:一旦交付,BOM 就会更新并推送到 Nexus(存储为 1.0-SNAPSHOT 版本,不断被覆盖)每次交货后)

A BOM is only updated when our release management process completes the delivery of a built module (or group of modules): once delivered, then the BOM is updated and pushed to Nexus (stored as a 1.0-SNAPSHOT version, constantly overridden after each delivery)

BOM 然后包含在我们的 POM 中(用于单模块或多模块项目)并仅用于依赖项管理,这意味着我们的项目依赖于工件没有版本:来自 BOM 的依赖项管理提供其他依赖模块的最新交付版本.

The BOM is then included within our POM (for mono or multi-module projects) and use for dependency management only, meaning our projects depends on artifact without the version: the dependency management from the BOM provides with the latest delivered version of other dependent modules.

换句话说,我们将构建方面(此处使用 maven 完成)与发布部分分开:材料清单"代表已交付的内容,并确保所有项目都使用被认为可以很好地协同工作的版本进行构建(因为它们已一起交付生产).

In other words, we separate the build aspect (done here with maven) from the release part: the "bills of materials" represent what has been delivered, and ensure all projects are building with versions deemed working well together (since they have been delivered into production together).

这篇关于从多模块项目发布 bom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆