title: Jenkins build Groovy exist error Unable to load class hudson.model.Hudson due to missing dependency
body: <p>I am beginner in Groovy and Jenkins. I try to start a job as Freestyle project
  <br/> I added <strong>Buid > Add build step > Execute groovy script</strong> and type code like this</p>
  
  <pre><code>#!/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.")
  }
  </code></pre>
  
  <p>I try run script by link <a href="http://localhost:8080/script" rel="nofollow noreferrer">http://localhost:8080/script</a> . it is working well
  <br/><strong>But there are a error Missing dependency</strong> </p>
  
  <blockquote>
    <p>[job_decision] $ D:path-to-groovy-home\groovy-2.4.7\bin\groovy.bat <br/> D:path-to-jenkin\Jenkins\workspace\job_decision\jenkin.groovy
    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:<br/>
    General error during class generation: java.lang.NoClassDefFoundError: Unable to load class hudson.model.Hudson due to missing dependency hudson/remoting/VirtualChannel <br/>
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class hudson.model.Hudson due to missing dependency hudson/remoting/VirtualChannel</p>
  </blockquote>