Maven Buildnumber plugin - Git

徘徊边缘 提交于 2019-12-02 20:37:29
Pascal Thivent

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!