我是Groovy和Jenkin的初学者 . 我尝试以Freestyle项目开始工作
我添加了 Buid > Add build step > Execute groovy script 并输入这样的代码

#!/usr/bin/env groovy
import hudson.model.*
import hudson.AbortException
import hudson.console.HyperlinkNote
import java.util.concurrent.CancellationException
// Start another job
def job = Hudson.instance.getJob('mhi_job_test2')
def anotherBuild
try {
    //def future = job.scheduleBuild()
    println "Waiting for the completion of " + job.url + "\nName:"+job.fullDisplayName // HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName)
    //anotherBuild = future.get()
} catch (CancellationException x) {
    throw new AbortException("${job.fullDisplayName} aborted.")
}

我尝试通过链接http://localhost:8080/script运行脚本 . 它运作良好
But there are a error Missing dependency

[job_decision] $ D:path-to-groovy-home \ groovy-2.4.7 \ bin \ groovy.bat D:path-to-jenkin \ Jenkins \ workspace \ job_decision \ jenkin.groovy org.codehaus.groovy.control .MultipleCompilationErrorsException:启动失败:类生成期间的常规错误:java.lang.NoClassDefFoundError:由于缺少依赖性而无法加载类hudson.model.Hudson hudson / remoting / VirtualChannel java.lang.RuntimeException:java.lang.NoClassDefFoundError:无法由于缺少依赖性hudson / remoting / VirtualChannel而加载类hudson.model.Hudson

我正在寻找,但没有anwser . 请帮忙