Yan*_*eve 33 zip plugins maven-2
我希望创建一个我的"目标"目录的zip存档($ {project.build.directory).使用maven-assembly-plugin似乎对我来说这样一个简单的任务有点过分(有点复杂 - 为什么我必须使用另一个文件,汇编描述符,用于这样的任务)我找不到看似更简单的maven- http://repo1.maven.org/maven2存储库中的zip-plugin.
有什么输入?
Pas*_*ent 56
如果bin
预定义的程序集描述符不符合您的需要,那么您有三个选项:
就个人而言,我只使用带有以下zip.xml
描述符的maven-assembly-plugin :
<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>
Run Code Online (Sandbox Code Playgroud)
在你的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>
Run Code Online (Sandbox Code Playgroud)
RTB*_*ard 14
如果您对生成的.zip文件没有任何"特殊"需求,则可以使用其中一个预定义的Maven程序集描述符.预定义的程序集描述符使您可以轻松快速轻松地创建特定程序集,而无需提供自己的程序集描述符.假设您想使用bin
预定义的描述符.然后在plugins
POM build
部分的部分中,您可以添加以下内容.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>bin</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
当然,和Maven一样,如果你想要做一些超出默认配置的事情,你必须创建自己的配置,在这种情况下,这意味着你自己的汇编描述符.
此处记录了预定义描述符列表.