1
votes

I have installed the scripter plugin on Jenkins 1.501:

https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin

I have created this script:

import org.apache.commons.httpclient.*
import org.apache.commons.httpclient.auth.*
import org.apache.commons.httpclient.methods.*

@Grab(group='commons-httpclient', module='commons-httpclient', version='3.1')
void createNewJenkinsProject() {

  out.println("Test")


}
createNewJenkinsProject()

based on this example:

https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients

On a job on one of my slaves I add the above script as a build step. When I build the job I get:

Execution of script [move-projects.groovy] failed - java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReportorg.jenkinsci.plugins.scriptler.util.GroovyScript$ScriptlerExecutionException: java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
    at org.jenkinsci.plugins.scriptler.util.GroovyScript.call(GroovyScript.java:66)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
1
This seems to be related to issues.jenkins-ci.org/browse/JENKINS-16361 (@Grab Grape support)Timor

1 Answers

5
votes

If you have chosen "Execute System Groovy Script" as the build action, then this will run on Jenkins master. So ensure that all the required jars are present in the class path. You can also check the script even before using it. To do that, go to your-jenkins-url/jenkins/script and paste the script and test

If " Execute Groovy Script" option is chosen, ensure that the jars are in classpath of the slave.