问题
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
回答1:
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.
回答2:
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.
回答3:
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.
回答4:
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.
回答5:
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.
回答6:
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
回答7:
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.
来源:https://stackoverflow.com/questions/2685069/maven-buildnumber-plugin-git