[英]How can I reference a multi-module maven project?
I have a multimodule project, let's call it "multi". 我有一个多模块项目,我们称它为“多”。 it generates like 5 jar artifacts.
它会生成5个jar伪像。
I would like to simply reference "multi" from another project's pom and get everything i need, without having to indivdivually reference each of the 5 jar's generated by "multi" in my the referencing pom file. 我想简单地从另一个项目的pom引用“ multi”并获得我需要的一切,而不必在我引用的pom文件中单独引用“ multi”生成的5个jar的每个。
Isn't that possible? 那不可能吗?
You can create a sixth module (container artifact) in the "multi" project and have it depend on the 5 artifacts you have. 您可以在“ multi”项目中创建第六个模块(容器工件),并使它取决于您拥有的5个工件。 Then you only reference this new module in the other project.
然后,您仅在另一个项目中引用此新模块。
multi:
- artifact1
- artifact2
- artifact3
- artifact4
- artifact5
- containerArtifact has all the above five as dependencies.
In the other project: 在另一个项目中:
<dependency>
<groupId>groupId</groupId>
<artifactId>containerArtifact</artifactId>
</dependency>
You need a new module to work as the assembler plugin. 您需要一个新模块作为汇编程序插件。 This module will collect all dependencies for the other modules and create the package you want.
该模块将收集其他模块的所有依赖关系,并创建所需的包。
This is done through the mavenassemblyplugin. 这是通过mavenassemblyplugin完成的。 This is from the Maven website: http://maven.apache.org/plugins/maven-assembly-plugin/
这来自Maven网站: http : //maven.apache.org/plugins/maven-assembly-plugin/
Examples can be found here: http://maven.apache.org/plugins-archives/maven-assembly-plugin-2.4/examples/index.html 可以在这里找到示例: http : //maven.apache.org/plugins-archives/maven-assembly-plugin-2.4/examples/index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.