final GroovyClassLoader classLoader = new GroovyClassLoader(baseClassLoader);
addClassPathes(classLoader);
final GroovyShell groovy = new GroovyShell(classLoader, new Binding(), configuration);
try {
final Script script = groovy.parse(txt, scriptName);
script.setProperty("ant", new AntBuilder(this));
script.setProperty("project", project);
script.setProperty("properties", new AntProjectPropertiesDelegate(project));
script.setProperty("target", getOwningTarget());
script.setProperty("task", this);
script.setProperty("args", cmdline.getCommandline());
if (mavenPom != null) {
script.setProperty("pom", mavenPom);
}
script.run();
}
catch (final MissingMethodException e) {
// not a script, try running through run method but properties will not be available
groovy.run(txt, scriptName, cmdline.getCommandline());
}