Maven:继承自聚合器

发布于 2024-12-21 05:53:03 字数 383 浏览 3 评论 0原文

我有以下情况:有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画尸师 2024-12-28 05:53:03

我会将项目 A 和 B 放入一个超级项目(项目 0?)中,该项目将它们聚合在一起。

Project 0
|
|-ProjectA
| |--component1
| |--component2
|
|-ProjectB

您可以

运行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

Project 0
|
|-ProjectA
| |--component1
| |--component2
|
|-ProjectB

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文