title: How do I pass arguments to a Groovy 2.0 script?
body: <p>I have 2 scripts, where I am trying to test passing an argument, and it fails.  I examined the documentation for GroovyScriptEngine but it doesn't seem to handle the case where I want to pass a arg rather than a property value pair (in a binding).</p>
  
  <p>Here is the error I get:</p>
  
  <pre><code>C:\AeroFS\Work\Groovy_Scripts&gt;groovy scriptengineexample.groovy
  hello, world
  Caught: groovy.lang.MissingPropertyException: No such property: args 
          for class: hello
  groovy.lang.MissingPropertyException: No such property: args for 
          class: hello
          at hello.run(hello.groovy:4)
          at Test.main(scriptengineexample.groovy:14)
  </code></pre>
  
  <p>Here are my scripts:</p>
  
  <pre><code>import groovy.lang.Binding;
  import groovy.util.GroovyScriptEngine;
  import groovy.util.ResourceException ;
  import groovy.util.ScriptException ;
  import java.io.IOException ;
  
  public class Test {
    public static void main( String[] args ) throws IOException, 
               ResourceException, ScriptException {
      GroovyScriptEngine gse = new GroovyScriptEngine( [ '.' ] as String[] )
      Binding binding = new Binding();
      binding.setVariable("input", "world");
      gse.run("hello.groovy", binding);
      System.out.println( "Output: " + binding.getVariable("output") );
    }
  }
  </code></pre>
  
  <p>And this one:</p>
  
  <pre><code>//hello.groovy
  println "hello.groovy"
  for (arg in this.args ) {
    println "Argument:" + arg;
  }
  </code></pre>