我希望创建一个我的“目标”目录($ {project.build.directory})的zip存档。 对于这样一个简单的任务,使用maven-assembly-plugin对我来说似乎有些过度(而且有点复杂 - 为什么必须使用另一个文件,即汇编描述符,来执行此任务)。
我无法在http://repo1.maven.org/maven2存储库中找到看似更简单的maven-zip-plugin。
有任何意见吗?
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>
在你的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>
bin
预定义描述符。那么在POM的build
部分的plugins
部分中,您只需要添加以下内容即可。<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>bin</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
${project.build.directory}/installers
),但你希望其他文件夹被省略?还是你有其他目标? - RTBarnard