Manifest Entries
If you find that the other configuration options for Maven Archiver are not enough for manipulating the manifest, you can add your own entries to it. This is done with the <manifestEntries>
configuration element.
In this example we'll add some entries to the manifest by specifying what we'd like in the <configuration>
/<archive>
element of maven-jar-plugin.
Note: As with all the examples here, this configuration can be used in all plugins that use Maven Archiver, not just maven-jar-plugin as in this example.
<project> <url>http://some.url.org/</url> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> ... <configuration> <archive> <manifestEntries> <mode>development</mode> <url>${project.url}</url> </manifestEntries> </archive> </configuration> ... </plugin> </plugins> </build> ... </project>
As you see above you can use literal values or you can have values from the POM interpolated into literals or simply use straight POM expressions. So this is what your resultant manifest will look like inside the created jar:
Manifest-Version: 1.0 Created-By: Apache Maven ${maven.version} Build-Jdk: ${java.version} mode: development url: http://some.url.org/
Note: If your pom.xml does not have the <url>
element, referenced through interpolation, then the entry url
will not be in the manifest.