Maven Buildnumber 插件 - Git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2685069/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven Buildnumber plugin - Git
提问by
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.
Maven Buildnumber 插件似乎还不能与 GIT 一起使用。暂时有解决方法吗?我最近从 SVN 切换到 GIT 并发现它很容易转换,但这是我目前唯一没有工作的事情。
Walter
沃尔特
采纳答案by Pascal Thivent
Well, there is MOJO-1199about the buildnumber plugin and GIT support but the patches haven't been applied yet. However, it seems that Antony Stubbsdid some work around this and made it available in this git mirror. Have a look at it.
嗯,有关于 buildnumber 插件和 GIT 支持的MOJO-1199,但尚未应用补丁。然而,Antony Stubbs似乎对此做了一些工作,并在这个git mirror 中提供了它。看看它。
回答by young.fu.panda
I use this Maven plugin:
我使用这个 Maven 插件:
https://github.com/ktoso/maven-git-commit-id-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).
并让它直接将值过滤到我的 spring 文件中,我可以将它们注入到我想要的任何东西中(主要用于在启动时/或通过 REST 服务报告版本)。
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.
首次启动时,将其设置为生成属性文件,以便您可以查看所有可用内容。非常容易使用。爱它。
回答by matsev
What are you trying to achieve? I have just written a blog postthat describes how you can use the buildnumber-maven-pluginto add the Git SHA-1 to your project.
你想达到什么目的?我刚刚写了一篇博客文章,描述了如何使用buildnumber-maven-plugin将 Git SHA-1 添加到您的项目中。
For the record, I used version 1.0 of the plugin, which was released in April 2011.
作为记录,我使用了 2011 年 4 月发布的插件 1.0 版。
回答by alexkasko
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.
我在 git 中使用了 buildnumber-maven-plugin 有一段时间了。但是有一天我们的经理无法设置 Git CLI(在 win7 中使用非 ASCII 用户名)。它迫使我在没有 git 命令行的情况下使用 JGit API 编写 maven 插件。请参阅maven-jgit-buildnumber-plugin。
回答by Ruben
This blog postdescribes how to use profiles to have the buildnumber plugin work differently when in a git or svn working copy.
这篇博文描述了如何使用配置文件让 buildnumber 插件在 git 或 svn 工作副本中以不同的方式工作。
Obviously(*) the buildnumber created in the git repository does not contain the subversion revision number.
显然(*)在git仓库中创建的buildnumber不包含subversion修订号。
(*) 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.
(*) 在 git 存储库中为已经推送回 subverion 存储库的提交工作时,应该可以在 buildnumber 中包含 subversion 修订号。
回答by Yev
The current version of buildNumber plugin - 1.0 - supports the Git SCM. In the version 1.1-SNAPSHOT there is a new configuration tag shortRevisionLengthfor getting the short git id. More details http://yevgen-fr.blogspot.com/2012/02/maven-buildnumber-plugin-short-revision.html
buildNumber 插件的当前版本 - 1.0 - 支持 Git SCM。在 1.1-SNAPSHOT 版本中,有一个新的配置标签shortRevisionLength用于获取短 git id。更多详情http://yevgen-fr.blogspot.com/2012/02/maven-buildnumber-plugin-short-revision.html
回答by Koekiebox
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.
所以我写了我自己的,它只是执行git describe
并分配给要在 MANIFEST.MF 中使用的属性。
See: https://github.com/koekiebox/git-maven-plugin
参见:https: //github.com/koekiebox/git-maven-plugin
Thanks.
谢谢。