Maven:继承自聚合器
我有以下情况:有一个projectA,它有多个组件:
projectA/component1 projectA/component2
有一个projectA/pom.xml,它聚合(“模块”标签)这两个组件来构建projectA。
现在,projectB 依赖于projectA.component1,我的目标是仅使用一个命令构建projectB,而无需先手动构建projectA。有一种有效的方法 - 让projectB/pom.xml继承projectA/component1/pom.xml(其中打包是pom)。
但是当事情变得更大时,我理想地希望projectB继承projectA/pom.xml并使用projectA包含的任何组件。有办法做到这一点吗?
谢谢
I have the following situation: There is projectA which has multiple components:
projectA/component1
projectA/component2
there is a projectA/pom.xml which aggregates ('modules' tag) those 2 components to build projectA.
now, projectB depends on projectA.component1, and my goal is to build projectB using one command only, without manually building projectA first. There is one way which works - let projectB/pom.xml inherit from projectA/component1/pom.xml (where packaging is pom).
But when things get larger, I would ideally want projectB to inherit from projectA/pom.xml and use whatever components projectA consists of. Is there a way to do this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会将项目 A 和 B 放入一个超级项目(项目 0?)中,该项目将它们聚合在一起。
您可以
运行mvn install --projects=ProjectB --also-make
从项目 0 的根目录 ;它不会构建组件 2,因为 ProjectB 不依赖于它,但它会构建组件 1。
I would put project A and B in a super-project (Project 0 ?) which aggregates them both
You can run
mvn install --projects=ProjectB --also-make
from the root of project 0; it won't built component2 because ProjectB doesn't depend on it, but it will build component1.