Jenkins构建Groovy存在错误由于缺少依赖项

时间:2016-12-28 17:08:17

标签: jenkins groovy

我是Groovy和Jenkins的初学者。我尝试以Freestyle项目开始工作
我添加了 Buid>添加构建步骤>执行groovy脚本并输入如下代码

#!/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运行脚本。它运作良好
但是缺少依赖性

  

[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 / remoting / VirtualChannel,无法加载类hudson.model.Hudson   java.lang.RuntimeException:java.lang.NoClassDefFoundError:由于缺少依赖性hudson / remoting / VirtualChannel

,无法加载类hudson.model.Hudson

0 个答案:

没有答案