Maven Buildnumber plugin - Git

2019-03-11 01:08发布

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

7条回答
Explosion°爆炸
2楼-- · 2019-03-11 01:37

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.

查看更多
▲ chillily
3楼-- · 2019-03-11 01:42

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.

查看更多
Bombasti
4楼-- · 2019-03-11 01:45

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楼-- · 2019-03-11 01:46

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.

查看更多
Luminary・发光体
6楼-- · 2019-03-11 01:46

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.

查看更多
爷的心禁止访问
7楼-- · 2019-03-11 01:50

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

查看更多
登录 后发表回答