Table of Contents

Maven - Assembly (Plugin)

About

The assembly plugin will build assembly.

An “assembly” is a group of files, directories, and dependencies that are assembled into an archive format and distributed.

The plugin goals documentation can be found here.

Pom.xml

The whole plugin is made through Descriptor Files.

Descriptor Files

Custom

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/myDescriptor.xml</descriptor>
          </descriptors>
        </configuration>
        [...]
</project>

Descriptor Reference

Pre-defined

There is 4 Pre-defined Descriptor Files:

Example in the pom.xml with the jar-with-dependencies (See the descriptorRefs element)

<project>
  [...]
  <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>2.4</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
        [...]
</project>

Documentation / Reference