Maven - 依赖于多模块聚合器项目 [英] Maven - depend on multi-module aggregator project
问题描述
我有一个多模块的 maven 项目,其结构如下:
I've got a multi-module maven project, with a structure like:
projectA-parent
- module-1
- module-2
我还有另一个项目,我想将 projectA-parent
中的所有模块作为运行时依赖项引入(它是一个 Spring 应用程序,并且 projectA-parent
中的每个模块> 包含我希望能够自动装配的 Spring 服务).
And I have another project where I want to bring in all the modules in projectA-parent
as runtime dependencies (it's a Spring application, and each module in projectA-parent
contains Spring services that I want to be able to autowire).
我想做的是类似的事情
<dependency>
<groupId>projectA-group</groupId>
<artifactId>projectA-parent</artifactId>
<scope>runtime</scope>
</dependency>
这样,如果我向 projectA-parent
添加另一个模块,它会自动作为运行时依赖项引入(即,我不想在我的项目中添加每个新模块作为依赖项)我添加它们时的 Spring 应用程序).这种事情可能吗?
so that if I add another module to projectA-parent
it is automatically brought in as a runtime dependency (i.e., I don't want to have to add each new module as a dependency in my Spring application as I add them). Is such a thing possible?
推荐答案
我想我只是添加另一个引用项目中其他模块的模块,例如:
I guess I'd just add another module that referred to the other modules in your project, e.g.:
projectA-parent
- module-1
- module-2
- module-deps
with module-deps
作为依赖于 module-1
和 module-2
的 jar 或 pom.您必须在添加更多模块时更新 module-deps
,但至少它只在一处.
with module-deps
as a jar or pom that depends on module-1
and module-2
.
You'll have to update module-deps
as you add more modules, but at least it's only in one place.
这篇关于Maven - 依赖于多模块聚合器项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!