Cookbook: How To Add SVN Revision To A JAR Manifest?


This recipe describes how to add SVN revision to a JAR manifest.

Prerequisite Plugins

Here is the list of the plugins used:

Plugin Version
jar 2.6
buildnumber 1.3

Sample Generated Manifest

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: vsiveton
Build-Jdk: 1.5.0_12
SCM-Revision: 613393


Configuring Mojo Buildnumber Plugin

We configure this plugin as suggested in the Mojo Buildnumber Plugin usage page.


Configuring Maven Jar Plugin

The last configuration is to customize the default Manifest with a new entry for the SCM revision.


Running Maven

Just call Maven to generate the package:

mvn package

Note: You need to have committed your project into SVN.

Other Tips

You could tweak the Jar Plugin configuration into the War Plugin.