Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy files from one folder to another with Groovy

Tags:

grails

groovy

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"

like image 224
Britman Avatar asked Feb 03 '14 12:02

Britman


2 Answers

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

like image 52
Alexander Tokarev Avatar answered Sep 16 '22 23:09

Alexander Tokarev


I am using Grails 2.4.3 and Java 1.6. In my case the solution was added the includes option like this:

new AntBuilder().copy(todir: destinationDir) {
    fileset(dir: sourceDir, includes: "**")
}
like image 39
esalomon Avatar answered Sep 17 '22 23:09

esalomon