AntBuilder在Groovy Console中工作,但在Eclipse中不工作
发布时间:2020-12-14 16:25:45 所属栏目:大数据 来源:网络整理
导读:我正在运行 Windows 7.以下代码适用于Groovy控制台: def fileEx = new File(/Y:DocumentsTest File.txt/)def copyToFile = new File(/Y:DocumentsTest File - Copied by Groovy and Ant.txt/)ant = new AntBuilder()ant.copy(file:fileEx,tofile:copyTo
我正在运行
Windows 7.以下代码适用于Groovy控制台:
def fileEx = new File(/Y:DocumentsTest File.txt/) def copyToFile = new File(/Y:DocumentsTest File - Copied by Groovy and Ant.txt/) ant = new AntBuilder() ant.copy(file:fileEx,tofile:copyToFile) 但是当我尝试在Eclipse中将其作为Groovy脚本运行时,我收到此错误: 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 我尝试将ant.jar添加到myclasspath,Groovy lib文件夹中的ant.jar和Eclipse插件lib文件夹中的ant.jar,但这并没有解决问题. 解决方法
看起来像
groovy-eclipse plugin船只的一部分库完全安装了groovy.除了eclipse插件之外,您还需要完整安装
groovy,这可能是您已经拥有的.
您应该能够通过转到项目来解决问题,然后转到Properties-> Java Build Path,然后单击’Libraries’. ‘添加外部罐子’并导航到完整的groovy安装.在那里,lib目录应该有ant.jar和ant-launcher.jar.添加它们.这应该清除它(并排队调试的基础问题). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |