RSS Feed for This PostCurrent Article

Maven: Adding Custom Attributes and Build Timestamp to Manifest

Here is how I add custom attributes and build time stamp to my manifest file. Reference is made to the Maven CookBook.

First, in src/main/resources/META-INF/MANIFEST.MF, I added the following entries

Specification-Title: App Name
Specification-Version: ${pom.version} - ${build.time}
Specification-Vendor: Company Name
Implementation-Title: App Name
Implementation-Version: ${pom.version} - ${build.time}
Implementation-Vendor: Company Name
Built-By: ${}
Build-Jdk: ${java.version}
Build-Time: ${build.time}

In my pom.xml file, I added the following



I use Maven AntRun plugin to generate the build time,

        <mkdir dir="${}"/>
          <format property="last.updated" 
            pattern="yyyy-MM-dd hh:mm:ss"/>
        <echo file="${basedir}/target/" message="build.time=${last.updated}"/>

Then I set the pom file to use the default manifest file






Then generated MANIFEST.MF in the jar file will look like this.

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: admin
Build-Jdk: 1.5.0_14
Specification-Title: App Name
Specification-Version: 0.1 - 2008-02-21 01:03:13
Specification-Vendor: Company Name
Implementation-Title: App Name
Implementation-Version: 0.1 - 2008-02-21 01:03:13
Implementation-Vendor: Company Name
Build-Time: 2008-02-21 01:03:13

Trackback URL

RSS Feed for This Post1 Comment(s)

  1. James | Feb 5, 2009 | Reply

    I couldn’t get this to work with the war plugin instead of the jar. Is there something different you have to do with war plugins?

    I am using mvn 2.0.9 with the


1 Trackback(s)

  1. From Maven: Añadiendo el Timestamp al número de versión « El Blog de rubensa | Apr 15, 2009

Sorry, comments for this entry are closed at this time.