jendave wrote:Rob Cashwalker wrote:Then the question was if Maven had access to the SVN revision number? (or for that matter Git revision code, which is why I was researching it at the time...)
Yes, there is a plugin that will grab the SVN (or GIT, Mercurial) rev number. The best place to put it would be in the manifest file. Then your Mantis code could grab it. I am also going to use it to stamp the snapshot names. The snapshots usually have a timestamp, but it would be better to use the rev number.
done.
The manifest file now includes a new parameter - "Implementation-Build"
[dhudson_mbp41] META-INF > cat MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: dhudson
Build-Jdk: 1.6.0_26
Implementation-Title: Forge
Implementation-Version: 1.1.2-SNAPSHOT
Implementation-Vendor-Id: forge
Implementation-Vendor: CardForge
Main-Class: forge.Gui_NewGame
Implementation-Build: 9734 <----- SVN Rev
Here is a simple code snippet.
- Code: Select all
File manifestFile = new File(appServerHome, "META-INF/MANIFEST.MF");
Manifest mf = new Manifest();
mf.read(new FileInputStream(manifestFile));
Attributes atts = mf.getMainAttributes();
System.out.println("Version: " + atts.getValue("Implementation-Version"));
System.out.println("Build: " + atts.getValue("Implementation-Build"));