Home > OS >  Add groovy.yaml.* to Jenkins pipeline
Add groovy.yaml.* to Jenkins pipeline

Time:04-28

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

CodePudding user response:

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

CodePudding user response:

Here's the best solution,

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

  • Related