使用 AntBuilder
似乎是在 Groovy 中创建备份 zip 文件的最佳方法。该网站上有很多使用 copy
和 zip
等方法的解决方案,但我在 Groovy 2.1 中的 AntBuilder
类中看不到这些方法.5.我需要安装额外的 Jar 吗?
new AntBuilder().zip(
destfile: "mydir/myzip.zip") {
fileset(dir: "mydir/myFile.txt")
}
最佳答案
AntBuilder
中的方法是动态的,取决于已安装的 ant 任务。
在此处询问之前,您是否尝试过用它压缩文件夹?
如果你尝试一下,你应该会看到它有效
关于java - 在 Groovy 中备份文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21952207/