maven-2mercurialbuild-processhudsonbuild-numbers

Maven + Mercurial for Build Numbers


I can't figure out how to get a Mercurial revision id put into my Maven build (ideally I would like it in the MANIFEST of my jars and war).

The closest solution I could find is:

mvn -DbuildNumber=`hg id -i`

Which won't really work for Windows or my Hudson server. Luckily Hudson tags my builds but I would like some more assurance if the builds were also tagged with the Mercurial changset id.


Solution

  • Have a look at this previous question and the link from the accepted answer. Basically, you want to do the same thing except that you'll want to use the buildnumber:hgchangeset goal with Mercurial to get a changeset property with the content of hg id -i.