把当前的git分支放到项目版本中 [英] Put current git branch to project version

查看:123
本文介绍了把当前的git分支放到项目版本中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将当前的git分支放入pom xml的版本字段中。我在互联网上发现了一些建议做类似的帖子:

 < version> $ {scm.version}< /版本> 

但这似乎不适用于git。有没有其他的解决方案?

是的,使用为git提供git commit id插件



这非常简单。您可以使用它来获取git分支

  $ {git.branch} 



所以在你的情况下它会去:

 <版本> $ {git.branch}< /版本> 


I want to put the current git branch into the version field in pom xml. I found some post in the internet suggesting to do something like:

<version>${scm.version}</version>

but this seems not to work with git. Are there any other solutions?

解决方案

Yes, use the git commit id plugin for maven

It's pretty straightforward. You can use it to get the git branch with

${git.branch}

So in your case it would go:

<version>${git.branch}</version>

这篇关于把当前的git分支放到项目版本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆