I am running Windows 7. The following code works in the Groovy Console:
def fileEx = new File(/Y:\Documents\Test File.txt/) def copyToFile = new File(/Y:\Documents\Test File - Copied by Groovy and Ant.txt/) ant = new AntBuilder() ant.copy(file:fileEx, tofile:copyToFile)
but when I try to run it as Groovy Script in Eclipse, I get this error:
Caught: java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException at copyFile.run(copyFile.groovy:4) Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException
I tried adding ant.jar to myclasspath, both ant.jar in the Groovy lib folder and the folder in the lib folder of Eclipse plugins, but this does not solve the problem.
source share