[Groovy] Using AntBuilder to copy a directory

def ant = new AntBuilder()
ant.copy(todir:"backup" ){
fileset(dir:"images" )
}
// build.xml
<project name="test" basedir="." >
<target name="backupImages" >
<copy todir="backup" >
<fileset dir="images" />
</copy>
</target>
</project>
To copy an entire directory of files (including subdirectories), you need to use a nested fileset. Notice that the nested XML shows up as a nested closure in Groovy.

Groovy这种语法真的是挺特别的

原文地址:https://www.cnblogs.com/buhaiqing/p/2706876.html