'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
Solution 1:[1]
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
Solution 2:[2]
Here's the best solution,
Just use readYAML/writeYAML all along which is a Jenkins plugin not a groovy library.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Szymon Stepniak |
| Solution 2 | S.B |
