Maven Buildnumber plugin - Git

后端 未结 7 1653
心在旅途
心在旅途 2021-02-02 13:33

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 eas

相关标签:
7条回答
  • 2021-02-02 13:55

    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.

    0 讨论(0)
  • 2021-02-02 14:02

    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

    0 讨论(0)
  • 2021-02-02 14:11

    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.

    0 讨论(0)
  • 2021-02-02 14:11

    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.

    0 讨论(0)
  • 2021-02-02 14:16

    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.

    0 讨论(0)
  • 2021-02-02 14:17

    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.

    0 讨论(0)
提交回复
热议问题