gpt4 book ai didi

maven-2 - Maven 程序集插件 - 包括来自子模块的依赖项?

转载 作者:行者123 更新时间:2023-12-04 06:48:35 24 4
gpt4 key购买 nike

我正在尝试为大型多模块项目设置程序集插件。现在的目标是将我所有的工件放入一个目录中。这是我的描述符:

    <assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>Install-Package</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<scope>runtime</scope>
<outputDirectory>dependencies</outputDirectory>
</dependencySet>
</dependencySets>
<moduleSets>
<moduleSet>
<binaries>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>

目前,这会将我的所有工件复制到程序集目录。到现在为止还挺好。问题是依赖项文件夹仅包含主 pom 文件中列出的依赖项。有没有办法在程序集中包含子模块的依赖关系而不在根 pom 中列出它们? (如果将它们全部包含在根 pom 中,则会将额外未使用的依赖项添加到子模块中,如果它们是单独构建的)。

谢谢!

最佳答案

The problem is that the dependencies folder only includes dependencies that are listed in the main pom file.



是的,这就是“顶级” dependencySets做。

Is there a way to include the dependencies of the sub modules in the assembly without listing them all in the root pom?



删除“顶部” dependencySets并在 binaries 下声明一个您的 moduleSet 的元素:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>Install-Package</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<binaries>
<unpack>false</unpack>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<scope>runtime</scope>
<outputDirectory>dependencies</outputDirectory>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>

关于maven-2 - Maven 程序集插件 - 包括来自子模块的依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3436359/

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