Maven: Plugin: maven-assembly -plugin

Apache Maven Assembly Plugin

https://maven.apache.org/plugins/maven-assembly-plugin/index.html

Introduction

The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive.

Your project can build distribution "assemblies" easily, using one of the convenient, prefabricated assembly descriptors. These descriptors handle many common operations, such as packaging a project's artifact along with generated documentation into a single zip archive. Alternatively, your project can provide its own descriptor and assume a much higher level of control over how dependencies, modules, file-sets, and individual files are packaged in the assembly.

Currently it can create distributions in the following formats:

  • zip
  • tar
  • tar.gz (or tgz)
  • tar.bz2 (or tbz2)
  • tar.snappy
  • tar.xz (or txz)
  • jar
  • dir
  • war
  • and any other format that the ArchiveManager has been configured for

If your project wants to package your artifact in an uber-jar, the assembly plugin provides only basic support. For more control, use the Maven Shade Plugin.

To use the Assembly Plugin in Maven, you simply need to:

  • choose or write the assembly descriptor to use,
  • configure the Assembly Plugin in your project's pom.xml, and
  • run "mvn assembly:single" on your project.

To write your own custom assembly, you will need to refer to the Assembly Descriptor Format reference.

What is an Assembly?

An "assembly" is a group of files, directories, and dependencies that are assembled into an archive format and distributed. For example, assume that a Maven project defines a single JAR artifact that contains both a console application and a Swing application. Such a project could define two "assemblies" that bundle the application with a different set of supporting scripts and dependency sets. One assembly would be the assembly for the console application, and the other assembly could be a Swing application bundled with a slightly different set of dependencies.

The Assembly Plugin provides a descriptor format which allows you to define an arbitrary assembly of files and directories from a project. For example, if your Maven project contains the directory "src/main/bin", you can instruct the Assembly Plugin to copy the contents of this directory to the "bin" directory of an assembly and to change the permissions of the files in the "bin" directory to UNIX mode 755. The parameters for configuring this behavior are supplied to the Assembly Plugin by way of the assembly descriptor.

Goals

The main goal in the assembly plugin is the single goal. It is used to create all assemblies.

For more information about the goals that are available in the Assembly Plugin, see the plugin documentation page.

Usage

General instructions on how to use the Assembly Plugin can be found on the usage page. Some more specific use cases are described in the examples given below.

In case you still have questions regarding the plugin's usage, please have a look at the FAQ and feel free to contact the user mailing list. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.

If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our source repository and will find supplementary information in the guide to helping with Maven.

Examples

To provide you with better understanding on some usages of the Assembly Plugin, you can take a look into the examples which can be found here.


Pre-defined Descriptor Files

https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html

There are four predefined descriptor formats available for reuse, packaged within the Assembly Plugin. Their descriptorIds are:

bin

Use bin as the descriptorRef of your assembly-plugin configuration in order to create a binary distribution archive of your project. This built-in descriptor produces an assembly with the classifier bin in three archive formats: tar.gz, tar.bz2, and zip.

The assembled archive contains the binary JAR produced by running mvn package plus any README, LICENSE, and NOTICE files available in the project root directory.

Below is the bin descriptor format:


 
  1. <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
  4. <id>bin</id>
  5. <formats>
  6. <format>tar.gz</format>
  7. <format>tar.bz2</format>
  8. <format>zip</format>
  9. </formats>
  10. <fileSets>
  11. <fileSet>
  12. <directory>${project.basedir}</directory>
  13. <outputDirectory>/</outputDirectory>
  14. <includes>
  15. <include>README*</include>
  16. <include>LICENSE*</include>
  17. <include>NOTICE*</include>
  18. </includes>
  19. </fileSet>
  20. <fileSet>
  21. <directory>${project.build.directory}</directory>
  22. <outputDirectory>/</outputDirectory>
  23. <includes>
  24. <include>*.jar</include>
  25. </includes>
  26. </fileSet>
  27. <fileSet>
  28. <directory>${project.build.directory}/site</directory>
  29. <outputDirectory>docs</outputDirectory>
  30. </fileSet>
  31. </fileSets>
  32. </assembly>

jar-with-dependencies

Use jar-with-dependencies as the descriptorRef of your assembly-plugin configuration in order to create a JAR which contains the binary output of your project, along its the unpacked dependencies. This built-in descriptor produces an assembly with the classifier jar-with-dependencies using the JAR archive format.

Note that jar-with-dependencies provides only basic support for uber-jars. For more control, use the Maven Shade Plugin.

Below is the jar-with-dependencies descriptor format:


 
  1. <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
  4. <!-- TODO: a jarjar format would be better -->
  5. <id>jar-with-dependencies</id>
  6. <formats>
  7. <format>jar</format>
  8. </formats>
  9. <includeBaseDirectory>false</includeBaseDirectory>
  10. <dependencySets>
  11. <dependencySet>
  12. <outputDirectory>/</outputDirectory>
  13. <useProjectArtifact>true</useProjectArtifact>
  14. <unpack>true</unpack>
  15. <scope>runtime</scope>
  16. </dependencySet>
  17. </dependencySets>
  18. </assembly>

src

Use src as the descriptorRef in your assembly-plugin configuration to create source archives for your project. The archive will contain the contents of your project's /src directory structure, for reference by your users. The src descriptorId produces an assembly archive with the classifier src in three formats: tar.gz, tar.bz2, and zip.

Below is the src descriptor format:


 
  1. <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
  4. <id>src</id>
  5. <formats>
  6. <format>tar.gz</format>
  7. <format>tar.bz2</format>
  8. <format>zip</format>
  9. </formats>
  10. <fileSets>
  11. <fileSet>
  12. <directory>${project.basedir}</directory>
  13. <includes>
  14. <include>README*</include>
  15. <include>LICENSE*</include>
  16. <include>NOTICE*</include>
  17. <include>pom.xml</include>
  18. </includes>
  19. <useDefaultExcludes>true</useDefaultExcludes>
  20. </fileSet>
  21. <fileSet>
  22. <directory>${project.basedir}/src</directory>
  23. <useDefaultExcludes>true</useDefaultExcludes>
  24. </fileSet>
  25. </fileSets>
  26. </assembly>

project

Using the project <descriptorRef> in your Assembly Plugin configuration will produce an assembly containing your entire project, minus any build output that lands in the /target directory. The resulting assembly should allow your users to build your project using Maven, Ant, or whatever build system you have configured in your project's normal SCM working directory. It produces assemblies with the classifier project in three archive formats: tar.gz, tar.bz2, and zip.

The following is the assembly descriptor for the project descriptorRef:


 
  1. <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
  4. <id>project</id>
  5. <formats>
  6. <format>tar.gz</format>
  7. <format>tar.bz2</format>
  8. <format>zip</format>
  9. </formats>
  10. <fileSets>
  11. <fileSet>
  12. <directory>${project.basedir}</directory>
  13. <outputDirectory>/</outputDirectory>
  14. <useDefaultExcludes>true</useDefaultExcludes>
  15. <excludes>
  16. <exclude>**/*.log</exclude>
  17. <exclude>**/${project.build.directory}/**</exclude>
  18. </excludes>
  19. </fileSet>
  20. </fileSets>
  21. </assembly>

Plugin Documentation

https://maven.apache.org/plugins/maven-assembly-plugin/plugin-info.html

Goals available for this plugin:

Goal Description
assembly:help Display help information on maven-assembly-plugin.
Call mvn assembly:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
assembly:single Assemble an application bundle or distribution from an assembly descriptor. This goal is suitable either for binding to the lifecycle or calling directly from the command line (provided all required files are available before the build starts, or are produced by another goal specified before this one on the command line).
Note that the parameters descriptors, descriptorRefs, and descriptorSourceDirectory are disjoint, i.e., they are not combined during descriptor location calculation.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 3.0
JDK 1.7
Memory No minimum requirement.
Disk Space No minimum requirement.

Usage

You should specify the version in your project's plugin configuration:

 
  1. <project>
  2. ...
  3. <build>
  4. <!-- To define the plugin version in your parent POM -->
  5. <pluginManagement>
  6. <plugins>
  7. <plugin>
  8. <groupId>org.apache.maven.plugins</groupId>
  9. <artifactId>maven-assembly-plugin</artifactId>
  10. <version>3.1.0</version>
  11. </plugin>
  12. ...
  13. </plugins>
  14. </pluginManagement>
  15. <!-- To use the plugin goals in your POM or parent POM -->
  16. <plugins>
  17. <plugin>
  18. <groupId>org.apache.maven.plugins</groupId>
  19. <artifactId>maven-assembly-plugin</artifactId>
  20. <version>3.1.0</version>
  21. </plugin>
  22. ...
  23. </plugins>
  24. </build>
  25. ...
  26. </project>

For more information, see "Guide to Configuring Plug-ins"


Assembly

https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html

Maven Assembly Plugin relies on the provided assembly descriptors to dictate its execution. Although there are already prefabricated descriptors available for use, they can only suffice some of the common assembly requirements.

So in order for you to customize the way the Assembly Plugin creates your assemblies, you need to know how to use the Assembly Descriptor.

This descriptor specifies the type of assembly archive to create, the contents of the assembly, and the ways in which dependencies or its modules are bundled with an assembly.


 
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
    <id/>
    <formats/>
    <includeBaseDirectory/>
    <baseDirectory/>
    <includeSiteDirectory/>
    <containerDescriptorHandlers>
        <containerDescriptorHandler>
            <handlerName/>
            <configuration/>
        </containerDescriptorHandler>
    </containerDescriptorHandlers>
    <moduleSets>
        <moduleSet>
            <useAllReactorProjects/>
            <includeSubModules/>
            <includes/>
            <excludes/>
            <sources>
                <useDefaultExcludes/>
                <outputDirectory/>
                <includes/>
                <excludes/>
                <fileMode/>
                <directoryMode/>
                <fileSets>
                    <fileSet>
                        <useDefaultExcludes/>
                        <outputDirectory/>
                        <includes/>
                        <excludes/>
                        <fileMode/>
                        <directoryMode/>
                        <directory/>
                        <lineEnding/>
                        <filtered/>
                    </fileSet>
                </fileSets>
                <includeModuleDirectory/>
                <excludeSubModuleDirectories/>
                <outputDirectoryMapping/>
            </sources>
            <binaries>
                <outputDirectory/>
                <includes/>
                <excludes/>
                <fileMode/>
                <directoryMode/>
                <attachmentClassifier/>
                <includeDependencies/>
                <dependencySets>
                    <dependencySet>
                        <outputDirectory/>
                        <includes/>
                        <excludes/>
                        <fileMode/>
                        <directoryMode/>
                        <useStrictFiltering/>
                        <outputFileNameMapping/>
                        <unpack/>
                        <unpackOptions>
                            <includes/>
                            <excludes/>
                            <filtered/>
                            <lineEnding/>
                            <useDefaultExcludes/>
                            <encoding/>
                        </unpackOptions>
                        <scope/>
                        <useProjectArtifact/>
                        <useProjectAttachments/>
                        <useTransitiveDependencies/>
                        <useTransitiveFiltering/>
                    </dependencySet>
                </dependencySets>
                <unpack/>
                <unpackOptions>
                    <includes/>
                    <excludes/>
                    <filtered/>
                    <lineEnding/>
                    <useDefaultExcludes/>
                    <encoding/>
                </unpackOptions>
                <outputFileNameMapping/>
            </binaries>
        </moduleSet>
    </moduleSets>
    <fileSets>
        <fileSet>
            <useDefaultExcludes/>
            <outputDirectory/>
            <includes/>
            <excludes/>
            <fileMode/>
            <directoryMode/>
            <directory/>
            <lineEnding/>
            <filtered/>
        </fileSet>
    </fileSets>
    <files>
        <file>
            <source/>
            <outputDirectory/>
            <destName/>
            <fileMode/>
            <lineEnding/>
            <filtered/>
        </file>
    </files>
    <dependencySets>
        <dependencySet>
            <outputDirectory/>
            <includes/>
            <excludes/>
            <fileMode/>
            <directoryMode/>
            <useStrictFiltering/>
            <outputFileNameMapping/>
            <unpack/>
            <unpackOptions>
                <includes/>
                <excludes/>
                <filtered/>
                <lineEnding/>
                <useDefaultExcludes/>
                <encoding/>
            </unpackOptions>
            <scope/>
            <useProjectArtifact/>
            <useProjectAttachments/>
            <useTransitiveDependencies/>
            <useTransitiveFiltering/>
        </dependencySet>
    </dependencySets>
    <repositories>
        <repository>
            <outputDirectory/>
            <includes/>
            <excludes/>
            <fileMode/>
            <directoryMode/>
            <includeMetadata/>
            <groupVersionAlignments>
                <groupVersionAlignment>
                    <id/>
                    <version/>
                    <excludes/>
                </groupVersionAlignment>
            </groupVersionAlignments>
            <scope/>
        </repository>
    </repositories>
    <componentDescriptors/>
</assembly>

 

assembly

An assembly defines a collection of files usually distributed in an archive format such as zip, tar, or tar.gz that is generated from a project. For example, a project could produce a ZIP assembly which contains a project's JAR artifact in the root directory, the runtime dependencies in a lib/ directory, and a shell script to launch a stand-alone application.

Element Type Description
id String Sets the id of this assembly. This is a symbolic name for a particular assembly of files from this project. Also, aside from being used to distinctly name the assembled package by attaching its value to the generated archive, the id is used as your artifact's classifier when deploying.
formats/format* List<String> (Many) Specifies the formats of the assembly. It is often better to specify the formats via the goal parameter rather than here. For example, that allows different profiles to generate different types of archives. Multiple formats can be supplied and the Assembly Plugin will generate an archive for each of the desired formats. When deploying your project, all file formats specified will also be deployed. A format is specified by supplying one of the following values in a <format> subelement:
  • "zip" - Creates a ZIP file format
  • "tar" - Creates a TAR format
  • "tar.gz" or "tgz" - Creates a gzip'd TAR format
  • "tar.bz2" or "tbz2" - Creates a bzip'd TAR format
  • "tar.snappy" - Creates a snappy'd TAR format
  • "tar.xz" or "txz" - Creates a xz'd TAR format
  • "jar" - Creates a JAR format
  • "dir" - Creates an exploded directory format
  • "war" - Creates a WAR format
includeBaseDirectory boolean Includes a base directory in the final archive. For example, if you are creating an assembly named "your-app", setting includeBaseDirectory to true will create an archive that includes this base directory. If this option is set to false the archive created will unzip its content to the current directory.
Default value is: true.
baseDirectory String Sets the base directory of the resulting assembly archive. If this is not set and includeBaseDirectory == true, ${project.build.finalName} will be used instead. (Since 2.2-beta-1)
includeSiteDirectory boolean Includes a site directory in the final archive. The site directory location of a project is determined by the siteDirectory parameter of the Assembly Plugin.
Default value is: false.
containerDescriptorHandlers/containerDescriptorHandler* List<ContainerDescriptorHandlerConfig> (Many) Set of components which filter various container descriptors out of the normal archive stream, so they can be aggregated then added.
moduleSets/moduleSet* List<ModuleSet> (Many) Specifies which module files to include in the assembly. A moduleSet is specified by providing one or more of <moduleSet> subelements.
fileSets/fileSet* List<FileSet> (Many) Specifies which groups of files to include in the assembly. A fileSet is specified by providing one or more of <fileSet> subelements.
files/file* List<FileItem> (Many) Specifies which single files to include in the assembly. A file is specified by providing one or more of <file> subelements.
dependencySets/dependencySet* List<DependencySet> (Many) Specifies which dependencies to include in the assembly. A dependencySet is specified by providing one or more of <dependencySet> subelements.
repositories/repository* List<Repository> (Many) Specifies which repository files to include in the assembly. A repository is specified by providing one or more of <repository> subelements.
componentDescriptors/componentDescriptor* List<String> (Many) Specifies the shared components xml file locations to include in the assembly. The locations specified must be relative to the base location of the descriptor. If the descriptor was found via a <descriptorRef/> element in the classpath, any components it specifies will also be found on the classpath. If it is found by pathname via a <descriptor/> element the value here will be interpreted as a path relative to the project basedir. When multiple componentDescriptors are found, their contents are merged. Check out the descriptor components for more information. A componentDescriptor is specified by providing one or more of <componentDescriptor> subelements.

containerDescriptorHandler

Configures a filter for files headed into the assembly archive, to enable aggregation of various types of descriptor fragments, such as components.xml, web.xml, etc.

Element Type Description
handlerName String The handler's plexus role-hint, for lookup from the container.
configuration DOM Configuration options for the handler.

moduleSet

A moduleSet represent one or more project <module> present inside a project's pom.xml. This allows you to include sources or binaries belonging to a project's <modules>.
NOTE: When using <moduleSets> from the command-line, it is required to pass first the package phase by doing: "mvn package assembly:assembly". This bug/issue is scheduled to be addressed by Maven 2.1.

Element Type Description
useAllReactorProjects boolean If set to true, the plugin will include all projects in the current reactor for processing in this ModuleSet. These will be subject to include/exclude rules. (Since 2.2)
Default value is: false.
includeSubModules boolean If set to false, the plugin will exclude sub-modules from processing in this ModuleSet. Otherwise, it will process all sub-modules, each subject to include/exclude rules. (Since 2.2-beta-1)
Default value is: true.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of project coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of project artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
sources ModuleSources When this is present, the plugin will include the source files of the included modules from this set in the resulting assembly.
binaries ModuleBinaries When this is present, the plugin will include the binaries of the included modules from this set in the resulting assembly.

sources

Contains configuration options for including the source files of a project module in an assembly.

Element Type Description
useDefaultExcludes boolean Whether standard exclusion patterns, such as those matching CVS and Subversion metadata files, should be used when calculating the files affected by this set. For backward compatibility, the default value is true. (Since 2.2-beta-1)
Default value is: true.
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of files and directory to include. If none is present, then <includes> represents all valid values.
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of files and directory to exclude. If none is present, then <excludes> represents no exclusions.
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644 (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
fileSets/fileSet* List<FileSet> (Many) Specifies which groups of files from each included module to include in the assembly. A fileSet is specified by providing one or more of <fileSet> subelements. (Since 2.2-beta-1)
includeModuleDirectory boolean Specifies whether the module's finalName should be prepended to the outputDirectory values of any fileSets applied to it. (Since 2.2-beta-1)
Default value is: true.
excludeSubModuleDirectories boolean Specifies whether sub-module directories below the current module should be excluded from fileSets applied to that module. This might be useful if you only mean to copy the sources for the exact module list matched by this ModuleSet, ignoring (or processing separately) the modules which exist in directories below the current one. (Since 2.2-beta-1)
Default value is: true.
outputDirectoryMapping String Sets the mapping pattern for all module base-directories included in this assembly. NOTE: This field is only used if includeModuleDirectory == true. Default is the module's ${artifactId} in 2.2-beta-1, and ${module.artifactId} in subsequent versions. (Since 2.2-beta-1)
Default value is: ${module.artifactId}.

fileSet

A fileSet allows the inclusion of groups of files into the assembly.

Element Type Description
useDefaultExcludes boolean Whether standard exclusion patterns, such as those matching CVS and Subversion metadata files, should be used when calculating the files affected by this set. For backward compatibility, the default value is true. (Since 2.2-beta-1)
Default value is: true.
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of files and directory to include. If none is present, then <includes> represents all valid values.
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of files and directory to exclude. If none is present, then <excludes> represents no exclusions.
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
directory String Sets the absolute or relative location from the module's directory. For example, "src/main/bin" would select this subdirectory of the project in which this dependency is defined.
lineEnding String Sets the line-endings of the files in this fileSet. Valid values:
  • "keep" - Preserve all line endings
  • "unix" - Use Unix-style line endings (i.e. "\n")
  • "lf" - Use a single line-feed line endings (i.e. "\n")
  • "dos" - Use DOS-/Windows-style line endings (i.e. "\r\n")
  • "windows" - Use DOS-/Windows-style line endings (i.e. "\r\n")
  • "crlf" - Use carriage-return, line-feed line endings (i.e. "\r\n")
filtered boolean Whether to filter symbols in the files as they are copied, using properties from the build configuration. (Since 2.2-beta-1)
Default value is: false.

binaries

Contains configuration options for including the binary files of a project module in an assembly.

Element Type Description
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory, directly beneath the root of the archive.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of artifact coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of dependency artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644 (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
attachmentClassifier String When specified, the attachmentClassifier will cause the assembler to look at artifacts attached to the module instead of the main project artifact. If it can find an attached artifact matching the specified classifier, it will use it; otherwise, it will throw an exception. (Since 2.2-beta-1)
includeDependencies boolean If set to true, the plugin will include the direct and transitive dependencies of of the project modules included here. Otherwise, it will only include the module packages only.
Default value is: true.
dependencySets/dependencySet* List<DependencySet> (Many) Specifies which dependencies of the module to include in the assembly. A dependencySet is specified by providing one or more of <dependencySet> subelements. (Since 2.2-beta-1)
unpack boolean If set to true, this property will unpack all module packages into the specified output directory. When set to false module packages will be included as archives (jars).
Default value is: true.
unpackOptions UnpackOptions Allows the specification of includes and excludes, along with filtering options, for items unpacked from a module artifact. (Since 2.2-beta-1)
outputFileNameMapping String Sets the mapping pattern for all NON-UNPACKED dependencies included in this assembly. (Since 2.2-beta-2; 2.2-beta-1 uses ${artifactId}-${version}${dashClassifier?}.${extension} as default value) NOTE: If the dependencySet specifies unpack == true, outputFileNameMapping WILL NOT BE USED; in these cases, use outputDirectory. See the plugin FAQ for more details about entries usable in the outputFileNameMapping parameter.
Default value is: ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}.

dependencySet

A dependencySet allows inclusion and exclusion of project dependencies in the assembly.

Element Type Description
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory, directly beneath the root of the archive.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of artifact coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of dependency artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644 (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
useStrictFiltering boolean When specified as true, any include/exclude patterns which aren't used to filter an actual artifact during assembly creation will cause the build to fail with an error. This is meant to highlight obsolete inclusions or exclusions, or else signal that the assembly descriptor is incorrectly configured. (Since 2.2)
Default value is: false.
outputFileNameMapping String Sets the mapping pattern for all dependencies included in this assembly. (Since 2.2-beta-2; 2.2-beta-1 uses ${artifactId}-${version}${dashClassifier?}.${extension} as default value). See the plugin FAQ for more details about entries usable in the outputFileNameMapping parameter.
Default value is: ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}.
unpack boolean If set to true, this property will unpack all dependencies into the specified output directory. When set to false dependencies will be includes as archives (jars). Can only unpack jar, zip, tar.gz, and tar.bz archives.
Default value is: false.
unpackOptions UnpackOptions Allows the specification of includes and excludes, along with filtering options, for items unpacked from a dependency artifact. (Since 2.2-beta-1)
scope String Sets the dependency scope for this dependencySet.
Default value is: runtime.
useProjectArtifact boolean Determines whether the artifact produced during the current project's build should be included in this dependency set. (Since 2.2-beta-1)
Default value is: true.
useProjectAttachments boolean Determines whether the attached artifacts produced during the current project's build should be included in this dependency set. (Since 2.2-beta-1)
Default value is: false.
useTransitiveDependencies boolean Determines whether transitive dependencies will be included in the processing of the current dependency set. If true, includes/excludes/useTransitiveFiltering will apply to transitive dependency artifacts in addition to the main project dependency artifacts. If false, useTransitiveFiltering is meaningless, and includes/excludes only affect the immediate dependencies of the project. By default, this value is true. (Since 2.2-beta-1)
Default value is: true.
useTransitiveFiltering boolean Determines whether the include/exclude patterns in this dependency set will be applied to the transitive path of a given artifact. If true, and the current artifact is a transitive dependency brought in by another artifact which matches an inclusion or exclusion pattern, then the current artifact has the same inclusion/exclusion logic applied to it as well. By default, this value is false, in order to preserve backward compatibility with version 2.1. This means that includes/excludes only apply directly to the current artifact, and not to the transitive set of artifacts which brought it in. (Since 2.2-beta-1)
Default value is: false.

unpackOptions

Specifies options for including/excluding/filtering items extracted from an archive. (Since 2.2-beta-1)

Element Type Description
includes/include* List<String> (Many) Set of file and/or directory patterns for matching items to be included from an archive as it is unpacked. Each item is specified as <include>some/path</include> (Since 2.2-beta-1)
excludes/exclude* List<String> (Many) Set of file and/or directory patterns for matching items to be excluded from an archive as it is unpacked. Each item is specified as <exclude>some/path</exclude> (Since 2.2-beta-1)
filtered boolean Whether to filter symbols in the files as they are unpacked from the archive, using properties from the build configuration. (Since 2.2-beta-1)
Default value is: false.
lineEnding String Sets the line-endings of the files. (Since 2.2) Valid values:
  • "keep" - Preserve all line endings
  • "unix" - Use Unix-style line endings
  • "lf" - Use a single line-feed line endings
  • "dos" - Use DOS-style line endings
  • "crlf" - Use Carraige-return, line-feed line endings
useDefaultExcludes boolean Whether standard exclusion patterns, such as those matching CVS and Subversion metadata files, should be used when calculating the files affected by this set. For backward compatibility, the default value is true. (Since 2.2)
Default value is: true.
encoding String Allows to specify the encoding to use when unpacking archives, for unarchivers that support specifying encoding. If unspecified, archiver default will be used. Archiver defaults generally represent sane (modern) values.

file

A file allows individual file inclusion with the option to change the destination filename not supported by fileSets.

Element Type Description
source String Sets the absolute or relative path from the module's directory of the file to be included in the assembly.
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory.
destName String Sets the destination filename in the outputDirectory. Default is the same name as the source's file.
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644 (more on unix-style permissions)
lineEnding String Sets the line-endings of the files in this file. Valid values are:
  • "keep" - Preserve all line endings
  • "unix" - Use Unix-style line endings (i.e. "\n")
  • "lf" - Use a single line-feed line endings (i.e. "\n")
  • "dos" - Use DOS-/Windows-style line endings (i.e. "\r\n")
  • "windows" - Use DOS-/Windows-style line endings (i.e. "\r\n")
  • "crlf" - Use carriage-return, line-feed line endings (i.e. "\r\n")
filtered boolean Sets whether to determine if the file is filtered.
Default value is: false.

repository

Defines a Maven repository to be included in the assembly. The artifacts available to be included in a repository are your project's dependency artifacts. The repository created contains the needed metadata entries and also contains both sha1 and md5 checksums. This is useful for creating archives which will be deployed to internal repositories.
NOTE: Currently, only artifacts from the central repository are allowed.

Element Type Description
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory, directly beneath the root of the archive.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of artifact coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of dependency artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644 (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
includeMetadata boolean If set to true, this property will trigger the creation of repository metadata which will allow the repository to be used as a functional remote repository.
Default value is: false.
groupVersionAlignments/groupVersionAlignment* List<GroupVersionAlignment> (Many) Specifies that you want to align a group of artifacts to a specified version. A groupVersionAlignment is specified by providing one or more of <groupVersionAlignment> subelements.
scope String Specifies the scope for artifacts included in this repository. (Since 2.2-beta-1)
Default value is: runtime.

groupVersionAlignment

Allows a group of artifacts to be aligned to a specified version.

Element Type Description
id String The groupId of the artifacts for which you want to align the versions.
version String The version you want to align this group to.
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define the artifactIds of the artifacts to exclude. If none is present, then <excludes> represents no exclusions. An exclude is specified by providing one or more of <exclude> subelements.

 


Component

https://maven.apache.org/plugins/maven-assembly-plugin/assembly-component.html

When creating several assemblies for a project with a custom assembly descriptor, it can't be helped that you will be duplicating some parts of a defined assembly. These duplicates can be extracted and placed in a separate file called a descriptor component.

Descriptor components contain FileSets, Files, and DependencySets meant to be shared by assembly descriptors by referencing them using <componentDescriptors>. It allows multiple assemblies to share a set of user defined collections.


 
  1. <component xmlns="http://maven.apache.org/ASSEMBLY-COMPONENT/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/ASSEMBLY-COMPONENT/2.0.0 http://maven.apache.org/xsd/assembly-component-2.0.0.xsd">
  3. <moduleSets>
  4. <moduleSet>
  5. <useAllReactorProjects/>
  6. <includeSubModules/>
  7. <includes/>
  8. <excludes/>
  9. <sources>
  10. <useDefaultExcludes/>
  11. <outputDirectory/>
  12. <includes/>
  13. <excludes/>
  14. <fileMode/>
  15. <directoryMode/>
  16. <fileSets>
  17. <fileSet>
  18. <useDefaultExcludes/>
  19. <outputDirectory/>
  20. <includes/>
  21. <excludes/>
  22. <fileMode/>
  23. <directoryMode/>
  24. <directory/>
  25. <lineEnding/>
  26. <filtered/>
  27. </fileSet>
  28. </fileSets>
  29. <includeModuleDirectory/>
  30. <excludeSubModuleDirectories/>
  31. <outputDirectoryMapping/>
  32. </sources>
  33. <binaries>
  34. <outputDirectory/>
  35. <includes/>
  36. <excludes/>
  37. <fileMode/>
  38. <directoryMode/>
  39. <attachmentClassifier/>
  40. <includeDependencies/>
  41. <dependencySets>
  42. <dependencySet>
  43. <outputDirectory/>
  44. <includes/>
  45. <excludes/>
  46. <fileMode/>
  47. <directoryMode/>
  48. <useStrictFiltering/>
  49. <outputFileNameMapping/>
  50. <unpack/>
  51. <unpackOptions>
  52. <includes/>
  53. <excludes/>
  54. <filtered/>
  55. <lineEnding/>
  56. <useDefaultExcludes/>
  57. <encoding/>
  58. </unpackOptions>
  59. <scope/>
  60. <useProjectArtifact/>
  61. <useProjectAttachments/>
  62. <useTransitiveDependencies/>
  63. <useTransitiveFiltering/>
  64. </dependencySet>
  65. </dependencySets>
  66. <unpack/>
  67. <unpackOptions>
  68. <includes/>
  69. <excludes/>
  70. <filtered/>
  71. <lineEnding/>
  72. <useDefaultExcludes/>
  73. <encoding/>
  74. </unpackOptions>
  75. <outputFileNameMapping/>
  76. </binaries>
  77. </moduleSet>
  78. </moduleSets>
  79. <fileSets>
  80. <fileSet>
  81. <useDefaultExcludes/>
  82. <outputDirectory/>
  83. <includes/>
  84. <excludes/>
  85. <fileMode/>
  86. <directoryMode/>
  87. <directory/>
  88. <lineEnding/>
  89. <filtered/>
  90. </fileSet>
  91. </fileSets>
  92. <files>
  93. <file>
  94. <source/>
  95. <outputDirectory/>
  96. <destName/>
  97. <fileMode/>
  98. <lineEnding/>
  99. <filtered/>
  100. </file>
  101. </files>
  102. <dependencySets>
  103. <dependencySet>
  104. <outputDirectory/>
  105. <includes/>
  106. <excludes/>
  107. <fileMode/>
  108. <directoryMode/>
  109. <useStrictFiltering/>
  110. <outputFileNameMapping/>
  111. <unpack/>
  112. <unpackOptions>
  113. <includes/>
  114. <excludes/>
  115. <filtered/>
  116. <lineEnding/>
  117. <useDefaultExcludes/>
  118. <encoding/>
  119. </unpackOptions>
  120. <scope/>
  121. <useProjectArtifact/>
  122. <useProjectAttachments/>
  123. <useTransitiveDependencies/>
  124. <useTransitiveFiltering/>
  125. </dependencySet>
  126. </dependencySets>
  127. <repositories>
  128. <repository>
  129. <outputDirectory/>
  130. <includes/>
  131. <excludes/>
  132. <fileMode/>
  133. <directoryMode/>
  134. <includeMetadata/>
  135. <groupVersionAlignments>
  136. <groupVersionAlignment>
  137. <id/>
  138. <version/>
  139. <excludes/>
  140. </groupVersionAlignment>
  141. </groupVersionAlignments>
  142. <scope/>
  143. </repository>
  144. </repositories>
  145. <containerDescriptorHandlers>
  146. <containerDescriptorHandler>
  147. <handlerName/>
  148. <configuration/>
  149. </containerDescriptorHandler>
  150. </containerDescriptorHandlers>
  151. </component>

component

Describes the component layout and packaging.

Element Type Description
moduleSets/moduleSet* List<ModuleSet> (Many) Specifies which module files to include in the assembly. A moduleSet is specified by providing one or more of <moduleSet> subelements.
fileSets/fileSet* List<FileSet> (Many) Specifies which groups of files to include in the assembly. A fileSet is specified by providing one or more of <fileSet> subelements.
files/file* List<FileItem> (Many) Specifies which single files to include in the assembly. A file is specified by providing one or more of <file> subelements.
dependencySets/dependencySet* List<DependencySet> (Many) Specifies which dependencies to include in the assembly. A dependencySet is specified by providing one or more of <dependencySet> subelements.
repositories/repository* List<Repository> (Many) Specifies a set of repositories to include in the assembly. A repository is specified by providing one or more of <repository> subelements.
containerDescriptorHandlers/containerDescriptorHandler* List<ContainerDescriptorHandlerConfig> (Many) Set of components which filter various container descriptors out of the normal archive stream, so they can be aggregated then added.

moduleSet

A moduleSet represent one or more project <module> present inside a project's pom.xml. This allows you to include sources or binaries belonging to a project's <modules>.
NOTE: When using <moduleSets> from the command-line, it is required to pass first the package phase by doing: "mvn package assembly:assembly". This bug/issue is scheduled to be addressed by Maven 2.1.

Element Type Description
useAllReactorProjects boolean If set to true, the plugin will include all projects in the current reactor for processing in this ModuleSet. These will be subject to include/exclude rules. Default value is true. (Since 2.2)
Default value is: false.
includeSubModules boolean If set to false, the plugin will exclude sub-modules from processing in this ModuleSet. Otherwise, it will process all sub-modules, each subject to include/exclude rules. Default value is true. (Since 2.2)
Default value is: true.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of project coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of project artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
sources ModuleSources When this is present, the plugin will include the source files of the included modules from this set in the resulting assembly.
binaries ModuleBinaries When this is present, the plugin will include the binaries of the included modules from this set in the resulting assembly.

sources

Contains configuration options for including the source files of a project module in an assembly.

Element Type Description
useDefaultExcludes boolean Whether standard exclusion patterns, such as those matching CVS and Subversion metadata files, should be used when calculating the files affected by this set. For backward compatibility, the default value is true. (Since 2.2)
Default value is: true.
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of files and directory to include. If none is present, then <includes> represents all valid values.
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of files and directory to exclude. If none is present, then <excludes> represents no exclusions.
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
fileSets/fileSet* List<FileSet> (Many) Specifies which groups of files from each included module to include in the assembly. A fileSet is specified by providing one or more of <fileSet> subelements. (Since 2.2)
includeModuleDirectory boolean Specifies whether the module's finalName should be prepended to the outputDirectory values of any fileSets applied to it. Default value is true. (Since 2.2)
Default value is: true.
excludeSubModuleDirectories boolean Specifies whether sub-module directories below the current module should be excluded from fileSets applied to that module. This might be useful if you only mean to copy the sources for the exact module list matched by this ModuleSet, ignoring (or processing separately) the modules which exist in directories below the current one. Default value is true. (Since 2.2)
Default value is: true.
outputDirectoryMapping String Sets the mapping pattern for all module base-directories included in this assembly. NOTE: This field is only used if includeModuleDirectory == true. Default is the module's ${artifactId} in 2.2-beta-1, and ${module.artifactId} in subsequent versions. (Since 2.2)
Default value is: ${module.artifactId}.

fileSet

A fileSet allows the inclusion of groups of files into the assembly.

Element Type Description
useDefaultExcludes boolean Whether standard exclusion patterns, such as those matching CVS and Subversion metadata files, should be used when calculating the files affected by this set. For backward compatibility, the default value is true. (Since 2.2)
Default value is: true.
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of files and directory to include. If none is present, then <includes> represents all valid values.
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of files and directory to exclude. If none is present, then <excludes> represents no exclusions.
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
directory String Sets the absolute or relative location from the module's directory. For example, "src/main/bin" would select this subdirectory of the project in which this dependency is defined.
lineEnding String Sets the line-endings of the files in this fileSet. Valid values:
  • "keep" - Preserve all line endings
  • "unix" - Use Unix-style line endings
  • "lf" - Use a single line-feed line endings
  • "dos" - Use DOS-style line endings
  • "crlf" - Use Carraige-return, line-feed line endings
filtered boolean Whether to filter symbols in the files as they are copied, using properties from the build configuration. (Since 2.2)
Default value is: false.

binaries

Contains configuration options for including the binary files of a project module in an assembly.

Element Type Description
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory, directly beneath the root of the archive.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of artifact coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of dependency artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
attachmentClassifier String When specified, the attachmentClassifier will cause the assembler to look at artifacts attached to the module instead of the main project artifact. If it can find an attached artifact matching the specified classifier, it will use it; otherwise, it will throw an exception. (Since 2.2)
includeDependencies boolean If set to true, the plugin will include the direct and transitive dependencies of of the project modules included here. Otherwise, it will only include the module packages only. Default value is true.
Default value is: true.
dependencySets/dependencySet* List<DependencySet> (Many) Specifies which dependencies of the module to include in the assembly. A dependencySet is specified by providing one or more of <dependencySet> subelements. (Since 2.2)
unpack boolean If set to true, this property will unpack all module packages into the specified output directory. When set to false module packages will be included as archives (jars). Default value is true.
Default value is: true.
unpackOptions UnpackOptions Allows the specification of includes and excludes, along with filtering options, for items unpacked from a module artifact. (Since 2.2)
outputFileNameMapping String Sets the mapping pattern for all NON-UNPACKED dependencies included in this assembly. Default is ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}. (Since 2.2-beta-2; 2.2-beta-1 uses ${artifactId}-${version}${dashClassifier?}.${extension}) NOTE: If the dependencySet specifies unpack == true, outputFileNameMapping WILL NOT BE USED; in these cases, use outputDirectory. See the plugin FAQ for more details about entries usable in the outputFileNameMapping parameter.
Default value is: ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}.

dependencySet

A dependencySet allows inclusion and exclusion of project dependencies in the assembly.

Element Type Description
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory, directly beneath the root of the archive.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of artifact coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of dependency artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
useStrictFiltering boolean When specified as true, any include/exclude patterns which aren't used to filter an actual artifact during assembly creation will cause the build to fail with an error. This is meant to highlight obsolete inclusions or exclusions, or else signal that the assembly descriptor is incorrectly configured. (Since 2.2)
Default value is: false.
outputFileNameMapping String Sets the mapping pattern for all dependencies included in this assembly. Default is ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}. (Since 2.2-beta-2; 2.2-beta-1 uses ${artifactId}-${version}${dashClassifier?}.${extension}). NOTE: If the dependencySet specifies unpack == true, outputFileNameMapping WILL NOT BE USED; in these cases, use outputDirectory. See the plugin FAQ for more details about entries usable in the outputFileNameMapping parameter.
Default value is: ${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}.
unpack boolean If set to true, this property will unpack all dependencies into the specified output directory. When set to false, dependencies will be included as archives (jars). Can only unpack jar, zip, tar.gz, and tar.bz archives. Default value is false.
Default value is: false.
unpackOptions UnpackOptions Allows the specification of includes and excludes, along with filtering options, for items unpacked from a dependency artifact. (Since 2.2)
scope String Sets the dependency scope for this dependencySet. Default scope value is "runtime".
Default value is: runtime.
useProjectArtifact boolean Determines whether the artifact produced during the current project's build should be included in this dependency set. Default value is true, for backward compatibility. (Since 2.2)
Default value is: true.
useProjectAttachments boolean Determines whether the attached artifacts produced during the current project's build should be included in this dependency set. Default value is false. (Since 2.2)
Default value is: false.
useTransitiveDependencies boolean Determines whether transitive dependencies will be included in the processing of the current dependency set. If true, includes/excludes/useTransitiveFiltering will apply to transitive dependency artifacts in addition to the main project dependency artifacts. If false, useTransitiveFiltering is meaningless, and includes/excludes only affect the immediate dependencies of the project. By default, this value is true. (Since 2.2)
Default value is: true.
useTransitiveFiltering boolean Determines whether the include/exclude patterns in this dependency set will be applied to the transitive path of a given artifact. If true, and the current artifact is a transitive dependency brought in by another artifact which matches an inclusion or exclusion pattern, then the current artifact has the same inclusion/exclusion logic applied to it as well. By default, this value is false, in order to preserve backward compatibility with version 2.1. This means that includes/excludes only apply directly to the current artifact, and not to the transitive set of artifacts which brought it in. (Since 2.2)
Default value is: false.

unpackOptions

Specifies options for including/excluding/filtering items extracted from an archive. (Since 2.2)

Element Type Description
includes/include* List<String> (Many) Set of file and/or directory patterns for matching items to be included from an archive as it is unpacked. Each item is specified as <include>some/path</include> (Since 2.2)
excludes/exclude* List<String> (Many) Set of file and/or directory patterns for matching items to be excluded from an archive as it is unpacked. Each item is specified as <exclude>some/path</exclude> (Since 2.2)
filtered boolean Whether to filter symbols in the files as they are unpacked from the archive, using properties from the build configuration. (Since 2.2)
Default value is: false.
lineEnding String Sets the line-endings of the files. (Since 2.2) Valid values:
  • "keep" - Preserve all line endings
  • "unix" - Use Unix-style line endings
  • "lf" - Use a single line-feed line endings
  • "dos" - Use DOS-style line endings
  • "crlf" - Use Carraige-return, line-feed line endings
useDefaultExcludes boolean Whether standard exclusion patterns, such as those matching CVS and Subversion metadata files, should be used when calculating the files affected by this set. For backward compatibility, the default value is true. (Since 2.2)
Default value is: true.
encoding String Allows to specify the encoding to use when unpacking archives, for unarchivers that support specifying encoding. If unspecified, archiver default will be used. Archiver defaults generally represent sane (modern) values.

file

A file allows individual file inclusion with the option to change the destination filename not supported by fileSets.

Element Type Description
source String Sets the absolute or relative path from the module's directory of the file to be included in the assembly.
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory.
destName String Sets the destination filename in the outputDirectory. Default is the same name as the source's file.
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
lineEnding String Sets the line-endings of the files in this file. Valid values are:
  • "keep" - Preserve all line endings
  • "unix" - Use Unix-style line endings
  • "lf" - Use a single line-feed line endings
  • "dos" - Use DOS-style line endings
  • "crlf" - Use Carraige-return, line-feed line endings
filtered boolean Sets whether to determine if the file is filtered.
Default value is: false.

repository

Defines a Maven repository to be included in the assembly. The artifacts available to be included in a repository are your project's dependency artifacts. The repository created contains the needed metadata entries and also contains both sha1 and md5 checksums. This is useful for creating archives which will be deployed to internal repositories.
NOTE: Currently, only artifacts from the central repository are allowed.

Element Type Description
outputDirectory String Sets the output directory relative to the root of the root directory of the assembly. For example, "log" will put the specified files in the log directory, directly beneath the root of the archive.
includes/include* List<String> (Many) When <include> subelements are present, they define a set of artifact coordinates to include. If none is present, then <includes> represents all valid values. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define a set of dependency artifact coordinates to exclude. If none is present, then <excludes> represents no exclusions. Artifact coordinates may be given in simple groupId:artifactId form, or they may be fully qualified in the form groupId:artifactId:type[:classifier]:version. Additionally, wildcards can be used, as in *:maven-*
fileMode String Similar to a UNIX permission, sets the file mode of the files included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0644 translates to User read-write, Group and Other read-only. The default value is 0644. (more on unix-style permissions)
directoryMode String Similar to a UNIX permission, sets the directory mode of the directories included. THIS IS AN OCTAL VALUE. Format: (User)(Group)(Other) where each component is a sum of Read = 4, Write = 2, and Execute = 1. For example, the value 0755 translates to User read-write, Group and Other read-only. The default value is 0755. (more on unix-style permissions)
includeMetadata boolean If set to true, this property will trigger the creation of repository metadata which will allow the repository to be used as a functional remote repository. Default value is false.
Default value is: false.
groupVersionAlignments/groupVersionAlignment* List<GroupVersionAlignment> (Many) Specifies that you want to align a group of artifacts to a specified version. A groupVersionAlignment is specified by providing one or more of <groupVersionAlignment> subelements.
scope String Specifies the scope for artifacts included in this repository. Default scope value is "runtime". (Since 2.2)
Default value is: runtime.

groupVersionAlignment

Allows a group of artifacts to be aligned to a specified version.

Element Type Description
id String The groupId of the artifacts for which you want to align the versions.
version String The version you want to align this group to.
excludes/exclude* List<String> (Many) When <exclude> subelements are present, they define the artifactIds of the artifacts to exclude. If none is present, then <excludes> represents no exclusions. An exclude is specified by providing one or more of <exclude> subelements.

containerDescriptorHandler

Configures a filter for files headed into the assembly archive, to enable aggregation of various types of descriptor fragments, such as components.xml, web.xml, etc.

Element Type Description
handlerName String The handler's plexus role-hint, for lookup from the container.
configuration DOM Configuration options for the handler.

 

 

 

 

 

 

 

 

Tags