问题
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.
回答1:
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}
Assuming this is ant
for the last part.
回答2:
Branch related parameters are described in TeamCity documentation: http://confluence.jetbrains.com/display/TCD8/Predefined+Build+Parameters#PredefinedBuildParameters-BranchRelatedParameters
来源:https://stackoverflow.com/questions/20045492/how-to-pass-branch-name-to-build-xml