如何将分支名称传递给 build.xml [英] How to pass branch name to build.xml

查看:25
本文介绍了如何将分支名称传递给 build.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比如说,我有这个分支规范:+:refs/heads/* 并且我想在 build.xml 中获取分支名称.任何像 ${vcsroot.branch} 这样的参数都会返回字符串 env.branch.

Say, I have this branch specification: +:refs/heads/* and I want to get branch name in build.xml. Any parameters like ${vcsroot.branch} return string env.branch.

推荐答案

您想添加一个名为 env.branch 之类的环境变量,然后将其值设置为 %teamcity.build.branch% 然后在您的 build.xml 中,您可以使用以下内容读取它:

You want to add an Environment Variable called something like env.branch then set its value to %teamcity.build.branch% then in your build.xml you can read it in using something like:

<property environment="env"/>
${env.branch}

假设这是最后一部分的 ant.

Assuming this is ant for the last part.

这篇关于如何将分支名称传递给 build.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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