简体   繁体   中英

Add groovy.yaml.* to Jenkins pipeline

How can I add the groovy.yaml.* to my jenkins pipeline? 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

Here's the best solution,

Just use readYAML/writeYAML all along which is a Jenkins plugin not a groovy library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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