我正在尝试编写一个管道脚本与 Jenkins 2.0 一起使用来复制我们现有的构建。这个原始构建使用 envInject 插件来读取 Java 属性文件,但我看不到如何从管道 Groovy 脚本中执行此操作。我用 Google 搜索并找到了以下内容,但它不起作用(FileNotFoundException):
Properties props = new Properties()
File propsFile = new File('./Builder/project.properties')
props.load(propsFile.newDataInputStream())
Thanks!
我昨天和今天刚刚为此奋斗过。我希望更容易找到它的可用性。
抓住'管道实用程序步骤 https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readproperties-read-properties-from-files-in-the-workspace-or-text' 插入。
使用 readProperties 步骤。
def props = readProperties file: 'dir/my.properties'
一句警告 - 我期望属性文件中的布尔值被视为字符串。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)