我已经在 Jenkins 1.501 上安装了脚本插件:
https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin
我创建了这个脚本:
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()
基于这个例子:
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
在我的一个奴隶的工作中,我将上述脚本添加为构建步骤。当我建立工作时,我得到:
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