Maven2 Assembly plugin

1. Creating a distribution

This plugin is used for creating distribution packages. e.g. if you want to publish a single tar.gz that contains documentation and other setup scripts, you can use this plugin to help create it as part of your maven build.

I've used this to create a single tar.gz that can be deployed to a fresh linux server that will install and run our application.

2. pom.xml

Below is an example maven project pom.xml that uses the assembly plugin. Note that there is a dependency on an existing war artifact so it can be included in the distribution.

<project xmlns="" xmlns:xsi=""


  <name>example :: distribution</name>

The file src/main/descriptors/example.xml contains further information on how to build the single tar.gz.

3. Contents of descriptor

Below is the contents of the descriptor, src/main/descriptors/example.xml

<?xml version="1.0" encoding="UTF-8"?>
  <!-- copy src/release directory -->


    <!-- Copy war file -->

It contains instructions to create a tar.gz archive. You can pick other archive formats too such as zip.

The 0755 is used for unix permission modes

The directory src/release is the top level directory for the distribution. Files are copied across from there. You can add deploy scripts and documentation here.

To include existing wars from your maven repo, you can use the dependencySet to get a copy of them.

I'm not sure how to rename the war file as part of the mvn build, and have worked around this using the deploy script.

4. mvn assembly:single

Use the command mvn assembly:single to trigger this plugin.