【问题标题】:Jenkins pipeline groovy odd behavior詹金斯管道常规的奇怪行为
【发布时间】:2019-03-14 12:21:04
【问题描述】:

我有一个 groovy 管道脚本:

stage("Test") {
    str="[\"asd1\", \"asd2\"]"
    def tagNames = str.tokenize(',[]').collect { it as String }
    echo "${tagNames.getClass()}"
    echo "${tagNames.size}"
}

但在输出中我看到错误“未找到此类字段:字段 java.lang.String 大小”:

[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
class java.util.ArrayList
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
No such field found: field java.lang.String size. Administrators can decide whether to approve or reject this signature.
[Pipeline] End of Pipeline

我做错了什么?

编辑:我有“没有待处理的签名批准”。

【问题讨论】:

标签: jenkins-pipeline jenkins-groovy


【解决方案1】:

使用

size()

而不是

size

成功了。

【讨论】:

    猜你喜欢
    • 2017-05-24
    • 1970-01-01
    • 2019-01-09
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多