We are trying to use some custom helper functions from a .jar
library in our Jenkinsfile. To achieve this, we want to use the @Grab
annotation from groovy/grape. Our Jenkinsfile looks like this:
@Grab('com.company:jenkins-utils:1.0')
import com.company.jenkinsutils.SomeClass
pipeline {
...
}
When trying to run the pipeline, we get the following error message:
java.lang.RuntimeException: No suitable ClassLoader found for grab
I already tried specifying @GrabConfig(systemClassLoader = true)
, however to no success. I suppose is has to do with the pipeline scripts running in the sandbox mode? Is there any way to make this work?