title: groovy.lang.MissingPropertyException: No such property: manager for class: Script1
body: <p>I am trying to invoke Groovy inside Hudson (using groovy plugin) to get some properties for our build. But I am getting this exception:</p>
  <blockquote>
  <p>groovy.lang.MissingPropertyException: No such property: manager for class: Script1</p>
  </blockquote>
  <p>I get this with the following line:</p>
  <pre><code>def buildNUmber = manager.build.number
  </code></pre>
  <p>This happens when I run as an inline command within Jenkins as well as using a script:</p>
  <p>I tried the solution below, but it fails during the declaration itself (line two):</p>
  <pre><code>Binding binding = new Binding();
  binding.setVariable(&quot;manager&quot;, manager);
  GroovyShell shell = new GroovyShell(binding);
  shell.evaluate(new File(&quot;d:/dev/others/hudson/userContent/ScriptStuff.groovy&quot;).text);
  </code></pre>
  <p>The above is run using: Groovy command. And when I run the build it errors and complains about the line - <code>binding.setVariable(&quot;manager&quot;, manager);</code></p>
  <p>When I use the Groovy script file, then it complains about:</p>
  <pre><code> def buildNumber = manager.build.number
  </code></pre>
  <p>Both errors are :</p>
  <blockquote>
  <p>groovy.lang.MissingPropertyException: No such property: manager for class: Script1</p>
  </blockquote>
  <p>Tried everything mentioned in this <a href="http://jenkins.361315.n4.nabble.com/Groovy-post-script-error-td3216762.html" rel="noreferrer">thread</a> as well:</p>
  <p>I am using Hudson 2.2.1 and Groovy 2.1.3. What could be wrong?</p>