Custom Maven Assembly Descriptors: Difference between revisions
Line 11: | Line 11: | ||
Aside from [[Maven_assembly_Plugin#Pre-defined_Assembly_Descriptors|pre-defined assembly descriptors]], Maven allows creation of custom assembly descriptors. Custom assembly descriptors are conventionally placed under <tt>src/assembly</tt> of the module that executes the plugin. | Aside from [[Maven_assembly_Plugin#Pre-defined_Assembly_Descriptors|pre-defined assembly descriptors]], Maven allows creation of custom assembly descriptors. Custom assembly descriptors are conventionally placed under <tt>src/assembly</tt> of the module that executes the plugin. | ||
=Assembly | =Assembly Descriptors and System Properties= | ||
Maven resolves system properties referred from values specified in the assembly descriptors. This helps with enforcing the pattern where module versions are specified in only one place - the parent project pom.xml. For more details, see "[[Multi-Module_Maven_Projects#Independent_Versions|Multi-module maven projects versioning]]" section. | Maven resolves system properties referred from values specified in the assembly descriptors. This helps with enforcing the pattern where module versions are specified in only one place - the parent project pom.xml. For more details, see "[[Multi-Module_Maven_Projects#Independent_Versions|Multi-module maven projects versioning]]" section. |
Revision as of 20:23, 7 November 2016
External
- Custom assembly descriptor reference http://maven.apache.org/components/plugins/maven-assembly-plugin/assembly.html
Internal
Overview
Aside from pre-defined assembly descriptors, Maven allows creation of custom assembly descriptors. Custom assembly descriptors are conventionally placed under src/assembly of the module that executes the plugin.
Assembly Descriptors and System Properties
Maven resolves system properties referred from values specified in the assembly descriptors. This helps with enforcing the pattern where module versions are specified in only one place - the parent project pom.xml. For more details, see "Multi-module maven projects versioning" section.
Example
This is an example of a custom assembly descriptor, used to build a complex release artifact for a multi-module project:
Elements
<id>
The <id> element in the assembly descriptor specifies the value of the assembly ID. The presence of the <id> element in the assembly descriptor is mandatory, if it is not specified, Maven will generate a parsing error. The assembly ID will become the assembly artifact classifier, present between the version and the extension. For more details on assembly artifact naming rules, see "The Name of the Assembly Artifact" section.