If the bin predefined assembly descriptor doesn’t suit your needs, then you have three options:
- Using the maven-assembly-plugin – The maven-zip-plugin never came out because the assembly plugin can do everything the zip plugin was doing, and more, see MNG-2243.
- Using the maven-antrun-plugin (and maybe the build-helper-plugin to attach the zip) – There is an example here (and this looks more verbose than the assembly plugin at the end).
- Writing your own plugin – why would you do this when you have the assembly plugin.
Personally, I would just use the maven-assembly-plugin with the following zip.xml descriptor:
<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>
And in your 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>