可以一个 Maven 父项目在其 `` 部分包含一个或多个子项目吗?

huangapple go评论67阅读模式
英文:

Can a Maven parent include one or more of its child inside its <dependencies> section?

问题

我有一个父POM,其中在其<dependencies>部分中提到了一个子POM。这样做是否允许?

请注意,这不是<dependencyManagement>部分,而是<dependencies>部分本身,因此从该父级继承的任何子级将默认情况下可以使用所有这些依赖项。

然而,作为父级的一部分并列在<dependencies>部分中的这些子级,在构建时是否可以从父级中排除?这种情况是否可能?

目前,子级构建失败,指出它们正在从父级的依赖项部分引用自身。

之所以将这些子级作为父级的依赖项部分的一部分,是因为这些依赖项必须默认情况下对父级的其他子级可用。

非常感谢任何建议/帮助!

英文:

I have a Parent POM that has a Child mentioned in its &lt;dependencies&gt; section. Is this allowed?

Please note this is not the &lt;dependencyManagement&gt; section but the &lt;dependencies&gt; section itself, so that any child inheriting from this parent will have all these dependencies available for them by default.

However, these children that are part of the &lt;dependencies&gt; section of the parent, have to somehow exclude themselves from the parent when they are built?, Is this possible?

Currently, the child builds are failing saying that they are referencing themselves from the dependencies section of the parent.

The reason why we have these children as part of the parent's dependencies section is because these dependencies have to be available by default for the other children of the parent implicitly.

Any suggestions / help is much appreciated!

答案1

得分: 1

你不能将模块用作父POM中的依赖项。

这些模块需要自己声明与其他模块的依赖关系。

英文:

You cannot use modules as dependencies in the parent POM.

The modules need to declare their dependencies to other modules themselves.

huangapple
  • 本文由 发表于 2020年10月12日 17:25:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/64315096.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定