Maven 2 在另一个模块中包含maven构建的程序集
我有2个maven模块。一个模块使用maven assembly插件构建一堆zip文件。第二个模块需要在其包中包含第一个模块构建的一些zip文件。这样做的方法是什么。多谢各位 最简单的方法是将ZIP部署到存储库中。对于本地存储库,使用install:install文件;对于中央存储库,使用deploy:deploy文件Maven 2 在另一个模块中包含maven构建的程序集,maven-2,maven,maven-assembly-plugin,maven-dependency-plugin,Maven 2,Maven,Maven Assembly Plugin,Maven Dependency Plugin,我有2个maven模块。一个模块使用maven assembly插件构建一堆zip文件。第二个模块需要在其包中包含第一个模块构建的一些zip文件。这样做的方法是什么。多谢各位 最简单的方法是将ZIP部署到存储库中。对于本地存储库,使用install:install文件;对于中央存储库,使用deploy:deploy文件 您可以在第二个模块中将ZIP声明为依赖项。因此,有人提到要将其部署到您的存储库中。如果您已经设置好将构建的工件部署到存储库,那么这很容易,如果没有,请查看 接下来,您需要使用插件
您可以在第二个模块中将ZIP声明为依赖项。因此,有人提到要将其部署到您的存储库中。如果您已经设置好将构建的工件部署到存储库,那么这很容易,如果没有,请查看 接下来,您需要使用插件将zip文件从存储库中签出。您可以使用shade或maven依赖插件。让我们假设maven依赖插件 因此,将此添加到插件部分的maven pom文件中:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>my.artifact.group.id</groupId>
<artifactId>my-artifact</artifactId>
<version>My-version</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/see</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
org.apache.maven.plugins
maven依赖插件
打开
过程源
打开
my.artifact.group.id
我的神器
我的版本
拉链
假的
${project.build.directory}/请参阅
显然,您需要更改工件的细节。这将把zip文件解压缩到target/see中。如果您想要实际的zip文件(看起来像是您想要的,但不清楚),只需将目标从“解包”更改为“复制依赖项”。您可能还必须删除outputDirectory或更改其他一些配置。只需在需要的地方使用它,并查看我上面提到的maven依赖插件页面以了解更多详细信息
希望有帮助