用于创建目录的 zip 存档的 Gradle 任务 [英] Gradle task to create a zip archive of a directory

查看:26
本文介绍了用于创建目录的 zip 存档的 Gradle 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 gradle 任务来创建一个目录的 zip 存档.gradle 任务是:

I have a gradle task to create a zip archive of a directory. The gradle task is:

task archiveReports(type: Zip) {
   from '/projects/Reports/*'
   archiveName 'Reports.zip'
}

当我运行命令gradle archiveReports"时,它显示构建成功.但是,没有创建 zip 文件.

When I am running the command 'gradle archiveReports', its showing the build is successful. However, no zip file is getting created.

我在这里遗漏了什么吗?

Am I missing something here?

推荐答案

我想出了一个办法:它现在对我有用.

I figured out a way for this: Its working for me now.

task myZip(type: Zip) {
   from 'Reports/'
   include '*'
   include '*/*' //to include contents of a folder present inside Reports directory
   archiveName 'Reports.zip'
   destinationDir(file('/dir1/dir2/dir3/'))
}

这篇关于用于创建目录的 zip 存档的 Gradle 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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