如何在java中获取Teamcity配置的值? [英] How to fetch the Value of Teamcity Configuration in java?
本文介绍了如何在java中获取Teamcity配置的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一段 java 代码,我必须在其中显示 Teamcity 构建配置名称.这段代码将在为配置配置的步骤之一中执行.
I have a piece of java code where I have to display the Teamcity build configuration name. This piece of code will be executed in one of the steps configured for the configuration.
我们可以读取 Teamcity 配置设置中设置的 env 变量 %env.TEAMCITY_BUILDCONF_NAME% 的值并使用或者有其他方法获取 Teamcity 配置名称的值吗?
can we read value of the env variable %env.TEAMCITY_BUILDCONF_NAME% set in Teamcity configuration settings and use or is there anyother way of o fetching the Value of Teamcity Configuration Name?
推荐答案
是的,你只需要读取代码中的环境变量值即可.
yes, you just need to read the environment variable value in the code.
这应该可以满足您的需求:
This should get what you need:
final String buildConfigName = System.getenv("TEAMCITY_BUILDCONF_NAME");
这篇关于如何在java中获取Teamcity配置的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文