假设我需要管理一个由作为zip存档汇总的aribtrary文件夹/文件结构组成的工件.我不清楚如何以最适合"Maven方式"的方式在Maven中实现这一目标.
我知道没有"拉链"包装类型.这是否意味着Maven中没有通用的生命周期,只需将我在资源文件夹中的内容,拉链并将其安装/部署到我的存储库中即可?
我正在寻找各种选择,评估每个选项如何满足我遵循maven方式的要求,因为我不希望招致明显的偏离金色道路的惩罚...
我正在尝试让Project B下拉(并解压缩)由Project A构建并部署到远程存储库的ZIP .
使用maven-assembly-plugin包装类型创建并附加ZIP pom:
<artifactId>project-a</artifactId>
<name>ZIP</name>
<description>Used by Project B</description>
<packaging>pom</packaging>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>distribution-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/scripts.xml</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
试图从项目B的pom中拉下来maven-dependency-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-scripts</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/staging</outputDirectory>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<overWrite>true</overWrite>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
失败了: [ERROR] Failed to execute goal on project ...: …
zip pom.xml maven maven-assembly-plugin maven-dependency-plugin