英文:
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 <dependencies>
section. Is this allowed?
Please note this is not the <dependencyManagement>
section but the <dependencies>
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 <dependencies>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论