在TeamCity Build Step中使用Maven属性

时间:2016-09-08 13:41:57

标签: maven teamcity

我想使用我在pom.xml中定义的属性。现在我想在TeamCity Build Step中引用这个属性值。

目前我只能使用其他方式在Maven中使用TeamCity属性。

特别是我想使用 url / path /%maven.output.type%/ something

等目标进行SSH Deployer
<properties>
    <!-- Art der Entwicklung -->
    <output.type>testing</output.type>
</properties>

我尝试的是在TeamCity中定义参数,但我不知道如何定义此参数的值。

有没有办法在TeamCity构建中使用此属性?

1 个答案:

答案 0 :(得分:1)

您可以运行一个脚本,该脚本将设置您可以在另一个构建步骤中使用的teamcity参数。以下是我使用的构建配置设置:

使用空文本值创建配置参数,并在下一步中使用名称(例如 outputType )。

添加构建步骤,其中运行器类型为命令行

  • 选择运行自定义脚本。

  • 在自定义脚本字段中,输入一个脚本,该脚本将从pom文件中提取值,并告诉teamcity在参数中设置它。例如:

    测试= sed -n 's:.*<output\.type>\(.*\)</output\.type>.*:\1:p' pom.xml

    echo&#34; ## teamcity [setParameter name =&#39; outputType&#39;值=&#39; $测试&#39;]&#34;

这将使用当前项目pom文件中找到的名为 output.type 的元素的值设置teamcity参数 outputType

在另一个构建步骤中,您可以在字段中使用该参数,例如目标字段:

somepath/%outputType%
相关问题