简体   繁体   English

添加 groovy.yaml.* 到 Jenkins 管道

[英]Add groovy.yaml.* to Jenkins pipeline

How can I add the groovy.yaml.* to my jenkins pipeline?如何将 groovy.yaml.* 添加到我的 jenkins 管道? I put it in my jekins pipeline,我把它放在我的杰金斯管道里,

@Library("shared-yaml")
import groovy.yaml.YamlBuilder
def yamlOne = new YamlBuilder()

Keep getting error,不断出错,

unable to resolve class groovy.yaml.YamlBuilder

Thanks, Ric谢谢,里克

You can't use groovy.yaml.YamlBuilder in the Jenkins pipeline, because it runs on Groovy 2.4.12, and the YamlBuilder was introduced in Groovy 3.0.0你不能在Jenkins管道中使用groovy.yaml.YamlBuilder ,因为它运行在Groovy 2.4.12,而YamlBuilder是在Groovy 3.0.0引入的

Here's the best solution,这是最好的解决方案,

Just use readYAML/writeYAML all along which is a Jenkins plugin not a groovy library.一直使用 readYAML/writeYAML,它是一个 Jenkins 插件而不是 groovy 库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM