gpt4 book ai didi

java - Maven 聚合两个不同的 Pom?

转载 作者:行者123 更新时间:2023-11-30 02:48:58 25 4
gpt4 key购买 nike

在 Maven 中,有什么方法可以将不同的父 pom 聚合到一个 POM 中吗?关于我的问题的更多描述:-

我将有两个 POM

  • 一个 POM (a) 用于依赖关系管理。
  • 另一个 POM (b) 用于插件管理。

通过组合(聚合)这两个 Pom,我将创建一个父 POM,并且我将要求我的其他模块团队使用它。

我知道 Maven 支持继承。使用继承我们可以实现这个要求。

maven支持两种不同Poms的组合吗?如果是的话我怎样才能实现这个目标?Maven 中的组合如何工作?

最佳答案

这对于依赖管理是可能的。在 <dependencyManagement> POM“b”的部分,您可以添加对 POM“a”的依赖关系,范围为 import .

来自Maven documentation :

This scope is only used on a dependency of type pom in the section. It indicates that the specified POM should be replaced with the dependencies in that POM's section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.

关于java - Maven 聚合两个不同的 Pom?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39304164/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com