Maven Buildnumber plugin – Git

The Maven Buildnumber plugin doesn’t appear to work with GIT yet. Is there a workaround for the time being? I recently switched from SVN to GIT and have found it to be an easy transition, but this is the only thing that I don’t have working presently.

Walter

  • Jenkins and maven-buildnumber-plugin
  • Get git SHA-1 of code merged by jenkins into maven
  • SVN revision number and timestamp
  • create build number in git-svn environment
  • git-log error: ambiguous argument 'master'
  • How to inject SVN revision number into JAR?
  • How do I merge a single commit?
  • git clone: warning: --depth is ignored in local clones; use file:// instead
  • Git submodules with separate work_tree
  • How to find the diff history of specific line in a file using git?
  • Push more than one netbeans project in one repository
  • two branches which compare equal with git diff but have different hashes
  • 7 Solutions collect form web for “Maven Buildnumber plugin – Git”

    Well, there is MOJO-1199 about the buildnumber plugin and GIT support but the patches haven’t been applied yet. However, it seems that Antony Stubbs did some work around this and made it available in this git mirror. Have a look at it.

    I use this Maven plugin:

    https://github.com/ktoso/maven-git-commit-id-plugin

    and have it filter values directly into my spring files where I can inject them into anything I want (mostly just for reporting versions at start-up / or via a REST service).

    When first starting, set it up to generate the properties file so you can see everything that is available. Extremely easy to use. Love it.

    What are you trying to achieve? I have just written a blog post that describes how you can use the buildnumber-maven-plugin to add the Git SHA-1 to your project.

    For the record, I used version 1.0 of the plugin, which was released in April 2011.

    I used buildnumber-maven-plugin with git for some time. But one day our manager was unable to setup Git CLI (in win7 with non ASCII user name). It forced me to write maven plugin using JGit API without git command line. See maven-jgit-buildnumber-plugin.

    This blog post describes how to use profiles to have the buildnumber plugin work differently when in a git or svn working copy.

    Obviously(*) the buildnumber created in the git repository does not contain the subversion revision number.

    (*) It should be possible to include the subversion revision number in the buildnumber when working in a git repository for commits that are already pushed back to the subverion repository.

    The current version of buildNumber plugin – 1.0 – supports the Git SCM.
    In the version 1.1-SNAPSHOT there is a new configuration tag shortRevisionLength for getting the short git id. More details http://yevgen-fr.blogspot.com/2012/02/maven-buildnumber-plugin-short-revision.html

    I had problems with getting the ones provided above to work.

    So I wrote my own, which simply executes the git describe and assigns to a property to be used in the MANIFEST.MF.

    See: https://github.com/koekiebox/git-maven-plugin

    Thanks.

    Git Baby is a git and github fan, let's start git clone.