maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Monsen <>
Subject Re: buildnumber-maven-plugin, git
Date Thu, 27 May 2010 04:43:16 GMT
On Thu, May 13, 2010 at 4:17 PM, Adam Monsen wrote:
> Some awesome folks have created a patch to the
> buildnumber-maven-plugin that supports Git. Apparently it works, but
> the integration tests do not pass. Is anyone interested in helping
> make the tests pass? If not, perhaps someone could offer some advice
> on how to debug plugin integration tests?

(the following was crossposted to the git mailing list)

FYI, I gave up trying to fix the integration tests, or to modify the
plugin to suit my needs. I instead used groovy script right in my
POM, and set project properties that are filtered into a file
included in our war.

Here's the Groovy snippet I used, modified to have shorter names to
prevent wrapping:

  def env = System.getenv()
  def gitcmd = "git"
  if (env['OS'] =~ /^Windows/)
      gitcmd = "cmd /c ${gitcmd}"
  def gcmd = """${gitcmd} log --pretty=format:%H -n1""".execute()['mifos_commit'] =['mifos_build'] = env['BUILD_TAG'] ?: 'DEV'['mifos_date'] = "" + new Date()

"BUILD_TAG" is something set by the Hudson continuous integration
server (that's what we use).

Here's the script, in vivo (commit 5dfe4d1abda09713b296ea2524):

I figured trading lots of lines of Java, XML, etc. for 8 lines of
maintainable/portable Groovy was a good move.

Hope this helps someone else using Maven and git who needs build
identifiers available as properties,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message