Consider the following snippet that pulls in snakeyaml and then just loops round some basic yaml.
@Grab('org.yaml:snakeyaml:1.17')
import org.yaml.snakeyaml.Yaml
List example = new Yaml().load("- \"wibble\"\n- \"wobble\"")
example.each{ println it }
In a basic build step "[email protected]" this works as expected.
wibble
wobble
In a basic build step "[email protected]" this dies a death...
Processing provided DSL script
FATAL: org/apache/ivy/core/settings/IvySettings
java.lang.ClassNotFoundException: org.apache.ivy.core.settings.IvySettings
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:560)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Caused: java.lang.NoClassDefFoundError: org/apache/ivy/core/settings/IvySettings
I know it is possible to use groovy in but I'm thinking that my jenkins server is not configured correctly and am not sure how to debug the issue.
Can anyone suggest some solutions?
This seems to be a known an open issue as described here. I got the same exception, running a barebones Jenkins instance inside a Docker container. The solution that worked for me seems more like a hack, but does the job quite well, it seems. Simply install the Pipeline Shared Groovy Libraries Plugin, which comes with support for Grape across the entire Jenkins instance.
Please, let me know, if it helped.