Maven: The Complete Reference
8.3. Overview of the Assembly Descriptor
When the standard assembly descriptors introduced in Section 8.2, “Assembly Basics” are not adequate, you will need to define your own assembly descriptor. The assembly descriptor is an XML document which defines the structure and contents of an assembly. The assembly descriptor contains five main configuration sections, plus two additional sections: one for specifying standard assembly-descriptor fragments, called component descriptors, and another for specifying custom file processor classes to help manage the assembly-production process.
- Base Configuration
- This section contains the information required by all assemblies, plus some additional configuration options related to the format of the entire archive, such as the base path to use for all archive entries. For the assembly descriptor to be valid, you must at least specify the assembly id, at least one format, and at least one of the other sections shown above.
- File Information
The configurations in this segment of the assembly descriptor apply
to specific files on the file system within the project’s directory
structure. This segment contains two main sections:
fileSets. You use
fileSetsto control the permissions of files in an assembly and to include or exclude files from an assembly.
- Dependency Information
- Almost all projects of any size depend on other projects. When creating distribution archives, project dependencies are usually included in the end-product of an assembly. This section manages the way dependencies are included in the resulting archive. This section allows you to specify whether dependencies are unpacked, added directly to the lib/ directory, or mapped to new file names. This section also allows you to control the permissions of dependencies in the assembly, and which dependencies are included in an assembly.
- Repository Information
- At times, it’s useful to isolate the sum total of all artifacts necessary to build a project, whether they’re dependency artifacts, POMs of dependency artifacts, or even a project’s own POM ancestry (your parent POM, its parent, and so on). This section allows you to include one or more artifact-repository directory structures inside your assembly, with various configuration options. The Assembly plugin does not have the ability to include plugin artifacts in these repositories yet.
- Module Information
This section of the assembly descriptor allows you to take
advantage of these parent-child relationships when assembling your
custom archive, to include source files, artifacts, and
dependencies from your project’s modules. This is the most complex
section of the assembly descriptor, because it allows you to work
with modules and sub-modules in two ways: as a series of
sourcessection) or as a series of