gpt4 book ai didi

maven-2 - Maven pom.xml - 项目聚合

转载 作者:行者123 更新时间:2023-12-01 02:55:16 25 4
gpt4 key购买 nike

我们有一个聚合 .pom 设置为包含几个单独的模块,类似于 Maven documentation :

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<packaging>pom</packaging>

<modules>
<module>my-module</module>
<module>my-module-2</module>
</modules>
</project>

有没有办法在构建后从这两个模块的构建(.JAR 文件)中获取工件到一个公共(public)的“dist”目录中?我不想调整“my-module/target”中各个模块的输出目录,因为它们也可以单独构建。

我是 Maven 新手,所以我确信有一种简单的方法可以做到这一点,我错过了。

最佳答案

Is there a way to get the artifacts from the builds (.JAR files) from these two modules into a common 'dist' directory after building?



Maven Assembly Plugin可以做到这一点,它非常强大和灵活。但功能和灵 active 也意味着这不是最简单的插件。在您的情况下,我们的想法是生成 dir来自 moduleSets 的分布你必须创建一个自定义 assembly descriptor为了那个原因。

我建议从第 8.2. Assembly Basics 章开始Maven 的书,并特别注意章节 8.5.5. moduleSets Sections .

关于maven-2 - Maven pom.xml - 项目聚合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3205579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com