Assembly plugin

Example that shows how to create a zip-file from a directory using the assembly plugin.

$ mvn package
[INFO] --- maven-assembly-plugin:3.6.0:single (execution-id) @ assembly-plugin ---
[INFO] Reading assembly descriptor: .../assembly.xml
[INFO] Building zip: .../target/final-assembly.zip

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>nl.ersoftware</groupId>
  <artifactId>assembly-plugin</artifactId>
  <version>1.0-SNAPSHOT</version>

  <packaging>pom</packaging>

  <build>
    <plugins>
      <plugin>
        <!-- NOTE: We don't need a groupId specification because the group is
             org.apache.maven.plugins ...which is assumed by default.
         -->
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.6.0</version>
        <executions>
          <execution>
            <id>execution-id</id>
            <goals>
                <goal>single</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <appendAssemblyId>false</appendAssemblyId>
              <descriptors>
                <descriptor>${basedir}/assembly.xml</descriptor>
              </descriptors>
              <finalName>final-assembly</finalName> <!-- name without extension -->
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

assembly.xml

<assembly>
    <id>assembly-id</id>
    <includeBaseDirectory>false</includeBaseDirectory>
    <formats>
        <format>zip</format>
    </formats>

    <fileSets>
        <fileSet>
            <directory>src</directory>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>
</assembly>