使用Groovy将文件从一个文件夹复制到另一个文件夹 [英] Copy files from one folder to another with Groovy

查看:1029
本文介绍了使用Groovy将文件从一个文件夹复制到另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 新的AntBuilder()。copy(todir:destinationDir){
fileset(dir:sourceDir)
}



我已经使用上述代码将文件从源文件复制到目标文件夹。



使用Grails 2.3.0正常工作,现在将grails更新为2.3.4,现在它不能在生产环境中工作。



现在获得以下错误
java。 lang.ClassNotFoundException:org.apache.tools.ant.BuildException

解决方案

如果您在JDK7上运行,则可以使用 java.nio.file.Files.copy(Path source,Path target,CopyOption ... options)方法


new AntBuilder().copy(todir: destinationDir) {
    fileset(dir: sourceDir)
}

i have used above code to copy a file from source to destination folder.

it was working fine with grails 2.3.0 now updated grails to 2.3.4 ,now its not working in production environment.

Now getting the following error "java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException"

解决方案

If you're running on JDK7, you can use java.nio.file.Files.copy(Path source, Path target, CopyOption... options) method

这篇关于使用Groovy将文件从一个文件夹复制到另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆