我想使用我在 pom.xml 中定义的属性。现在我想在我的 TeamCity Build Step 中引用这个属性值。
目前,我只能通过另一种方式在 Maven 中使用 TeamCity 属性。
特别是我想做一个 SSH 部署器,目标是 url/path/%maven.output.type%/something with
<properties>
<!-- Art der Entwicklung -->
<output.type>testing</output.type>
</properties>
我尝试的是在 TeamCity 中定义一个参数,但我不知道如何定义此参数的值。
有没有办法在 TeamCity 构建中使用此属性?
最佳答案
您可以运行一个脚本来设置一个 teamcity 参数,您可以在另一个构建步骤中使用该参数。以下是我使用的构建配置设置:
创建一个带有空文本值的配置参数,其名称在下一步中使用(例如 outputType)。
添加一个构建步骤,使用 runner 类型命令行:
测试=
sed -n 's:.*<output\.type>\(.*\)</output\.type>.*:\1:p' pom.xml
echo "##teamcity[setParameter name='outputType' value='$testing']"
这将使用在当前项目 pom 文件中找到的名为 output.type 的元素的值设置 teamcity 参数 outputType。
在另一个构建步骤中,您可以在一个字段中使用该参数,例如,目标字段:
somepath/%outputType%
关于maven - 在 TeamCity 构建步骤中使用 Maven 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39392568/