Apache Maven Archiver
The Maven Archiver is mainly used by plugins to handle packaging. The version numbers referenced in the Since column on this page are the version of the Maven Archiver component - not for any specific plugin. To see which version of Maven Archiver a plugin uses, go to the site for that plugin.
<archive> <addMavenDescriptor/> <compress/> <forced/> <index/> <pomPropertiesFile/> <manifestFile/> <manifest> <addClasspath/> <addDefaultEntries/> <addDefaultImplementationEntries/> <addDefaultSpecificationEntries/> <addBuildEnvironmentEntries/> <addExtensions/> <classpathLayoutType/> <classpathPrefix/> <customClasspathLayout/> <mainClass/> <packageName/> <useUniqueVersions/> </manifest> <manifestEntries> <key>value</key> </manifestEntries> <manifestSections> <manifestSection> <name/> <manifestEntries> <key>value</key> </manifestEntries> <manifestSection/> </manifestSections> </archive>
archive
The <archive>
element is the root of the archiver configuration. The following table lists all of the possible child elements.
Element | Type | Since | Description |
---|---|---|---|
addMavenDescriptor | boolean | Whether the created archive will contain these two Maven files:
true . | |
compress | boolean | Activate compression for the archive. The default value is true . | |
forced | boolean | 2.2 | Whether recreating the archive is forced (default) or not. Setting this option to false , means that the archiver should compare the timestamps of included files with the timestamp of the target archive and rebuild the archive, only if the latter timestamp precedes the former timestamps. Checking for timestamps will typically offer a performance gain (in particular, if the following steps in a build can be suppressed, if an archive isn't recreated) on the cost that you get inaccurate results from time to time. In particular, removal of source files won't be detected. An archiver doesn't necessarily support checks for uptodate. If so, setting this option to true . |
index | boolean | Deprecated: See JDK-8305597 Whether the created archive will contain an The default value is | |
pomPropertiesFile | File | 2.3 | Use this to override the auto created pom.properties file (only if addMavenDescriptor is set to true ) |
manifestFile | File | With this you can supply your own manifest file. | |
manifest | |||
manifestEntries | Map | A list of key/value pairs to add to the manifest. | |
manifestSections |
pom.properties content
The auto created META-INF/maven/${groupId}/${artifactId}/pom.properties
file will contain the following content:
artifactId=${project.artifactId} groupId=${project.groupId} version=${project.version}
manifest
The <manifest>
element configures main section of META-INF/MANIFEST.MF
. The following table lists all of the possible child elements.
Element | Type | Since | Description |
---|---|---|---|
addClasspath | boolean | Whether to create a Class-Path manifest entry. The default value is false . | |
addDefaultEntries | boolean | 3.4.0 | If the manifest will contain these entries: Since 3.5.0, the default value of Created-By entry can be overridden (usually by plugin code) using MavenArchiver.setCreatedBy(...) API.Since 3.6.5, Java-Version entry is discovered by BuildHelper.discoverJavaRelease(...) API.The default value is true . |
addDefaultImplementationEntries | boolean | 2.1 and 2.6 | If the manifest will contain these entries: The default value is false . |
addDefaultSpecificationEntries | boolean | 2.1 | If the manifest will contain these entries: The default value is false . |
addBuildEnvironmentEntries | boolean | 3.4.0 | If the manifest will contain these entries: The default value is false . |
addExtensions | boolean | Whether to create an Extension-List manifest entry. The default value is false . | |
classpathLayoutType | String | 2.4 | The type of layout to use when formatting entries in the created Class-Path . Valid values are: simple , repository (the same as a Maven classpath layout) and custom . Note: If you specify a type of custom you must also set customClasspathLayout . The default value is simple . |
classpathPrefix | String | A text that will be prefixed to all your Class-Path entries. The default value is "" . | |
customClasspathLayout | String | 2.4 | The layout expression to use when the layout type set in classpathLayoutType has the value custom . Expressions will be evaluated against the following ordered list of classpath-related objects:
custom you must set this layout expression. |
mainClass | String | The Main-Class manifest entry. | |
packageName | String | Package manifest entry. | |
useUniqueVersions | boolean | 2.4 | Whether to use unique timestamp Snapshot versions rather than -SNAPSHOT versions. The default value is true . |
manifestSection
The <manifestSection>
element configures sections of META-INF/MANIFEST.MF
. The following table lists all of the possible child elements.
Element | Type | Since | Description |
---|---|---|---|
name | String | The name of the section. | |
manifestEntries | Map | A list of key/value pairs to add to the manifest. |