maven-2之创建 maven "target"目录的 zip 存档
kerrycode
阅读:19
2025-05-04 20:05:19
评论:0
我希望为我的“目标”目录(${project.build.directory)创建一个 zip 存档。使用 maven-assembly-plugin 在我看来对于这样一个简单的任务来说有点矫枉过正(而且有点复杂 - 为什么我必须使用另一个文件,即程序集描述符来完成这样的任务)
我找不到看似更简单的maven-zip-plugin在 http://repo1.maven.org/maven2存储库。
任何输入?
请您参考如下方法:
如果 bin
预定义的程序集描述符不适合您的需求,那么您有三个选择:
就个人而言,我只会使用 maven-assembly-plugin 和以下
zip.xml
描述符:
<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>bin</id>
<baseDirectory>/</baseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
</fileSet>
</fileSets>
</assembly>
在你的 POM 中:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>single</goal> <!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。