I have folder **test** containing:

```
test
 -> groovy
     -> MyClass.groovy
 -> build.xml

```

The file **MyClass.groovy** contains:

```
class MyClass {
  void firstMethod(int i) {
    println i
  }

  String secondMethod(String txt) {
    return txt + "added text"
  }

  static void main(String[] args) {

  }
}

```

In my **build.xml** file I have (based on <http://docs.codehaus.org/display/GROOVY/The+groovy+Ant+Task>):

```
<target name="run-groovy-script-test">
    <groovy src="groovy/MyClass.groovy">
      <classpath>
        <pathelement location="groovy"/>
      </classpath>
        def aClass = new MyClass()
        aClass.secondMethod("asd")
    </groovy>
</target>   

```

Running the above gives:

```
 groovy.lang.MissingMethodException: No signature of method: MyClass.secondMethod() is applicable for argument types: (java.lang.String) values: [some-text]

```

**Solution**: Remove the src attribute - see below comments.

I know that I can specify a **main** method in the .groovy file which will automatically be executed using the above. But it could be nice to control which methods should be called directly.