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/>
  <manifest>
    <addClasspath/>
    <addDefaultEntries/>
    <addDefaultImplementationEntries/>
    <addDefaultSpecificationEntries/>
    <addBuildEnvironmentEntries/>
    <addExtensions/>
    <classpathLayoutType/>
    <classpathPrefix/>
    <customClasspathLayout/>
    <mainClass/>
    <packageName/>
    <useUniqueVersions/>
  </manifest>
  <manifestEntries>
    <key>value</key>
  </manifestEntries>
  <manifestFile/>
  <manifestSections>
    <manifestSection>
      <name/>
      <manifestEntries>
        <key>value</key>
      </manifestEntries>
    <manifestSection/>
  </manifestSections>
  <pomPropertiesFile/>
</archive>
      

archive

Element Description Type Since
addMavenDescriptor Whether the created archive will contain these two Maven files:
  • The pom file, located in the archive in META-INF/maven/${groupId}/${artifactId}/pom.xml
  • A pom.properties file, located in the archive in META-INF/maven/${groupId}/${artifactId}/pom.properties
The default value is true.
boolean
compress Activate compression for the archive. The default value is true. boolean
forced 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 recrated) 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 will simply be ignored.

The default value is true.
boolean 2.2
index Whether the created archive will contain an INDEX.LIST file. The default value is false. boolean
manifest
manifestEntries A list of key/value pairs to add to the manifest. Map
manifestFile With this you can supply your own manifest file. File
manifestSections
pomPropertiesFile Use this to override the auto created pom.properties file (only if addMavenDescriptor is set to true) File 2.3

manifest

Element Description Type Since
addClasspath Whether to create a Class-Path manifest entry. The default value is false. boolean
addDefaultEntries If the manifest will contain these entries:
Created-By: Maven Archiver ${maven-archiver.version}
Build-Jdk-Spec: ${java.specification.version}
The default value is true.
boolean 3.4.0
addDefaultImplementationEntries If the manifest will contain these entries:
Implementation-Title: ${project.name}
Implementation-Version: ${project.version}
Implementation-Vendor: ${project.organization.name}
The default value is false.
boolean 2.1 and 2.6
addDefaultSpecificationEntries If the manifest will contain these entries:
Specification-Title: ${project.name}
Specification-Version: ${project.artifact.selectedVersion.majorVersion}.${project.artifact.selectedVersion.minorVersion}
Specification-Vendor: ${project.organization.name}
The default value is false.
boolean 2.1
addBuildEnvironmentEntries If the manifest will contain these entries:
Build-Tool: ${maven.build.version}
Build-Jdk: ${java.version} (${java.vendor})
Build-Os:  ${os.name} (${os.version}; (${os.arch})
The default value is false.
boolean 3.4.0
addExtensions Whether to create an Extension-List manifest entry. The default value is false. boolean
classpathLayoutType 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.
String 2.4
classpathPrefix A text that will be prefixed to all your Class-Path entries. The default value is "". String
customClasspathLayout 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:
  1. The current Artifact instance, if one exists.
  2. The current ArtifactHandler instance from the artifact above.
Note: If you specify a layout type of custom you must set this layout expression.
String 2.4
mainClass The Main-Class manifest entry. String
packageName Package manifest entry. String
useUniqueVersions Whether to use unique timestamp Snapshot versions rather than -SNAPSHOT versions. The default value is true. boolean 2.4

manifestSection

Element Description Type Since
name The name of the section. String
manifestEntries A list of key/value pairs to add to the manifest. Map

pom.properties content

The auto created pom.properties file will contain the following content:

version=${project.version}
groupId=${project.groupId}
artifactId=${project.artifactId}