Skip to content

Instantly share code, notes, and snippets.

@holyjak
Created May 22, 2013 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holyjak/5628612 to your computer and use it in GitHub Desktop.
Save holyjak/5628612 to your computer and use it in GitHub Desktop.
Pom setup to include git/svn/mercurial revision in the generated MANIFEST.MF file
<project>
<build>
<plugins>
<plugin>
<!-- Create the property $buildNumber holding the current Git revision -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<!-- buildNumber is produced at runtime by buildnumber-maven-plugin -->
<Implementation-Version>${project.version} ${buildNumber}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment