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

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

问题描述

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

pre code任务archiveReports(类型:Zip){
from'/ projects / Reports / *'
archiveName'Reports.zip'
}

当我我正在运行命令'gradle archiveReports',它显示构建成功。但是,没有任何压缩文件正在创建。



我在这里丢失了什么?

解决方案

我找到了一个办法:
现在为我工作。

  task myZip(类型:Zip){
from'Reports /'
include'*'
include'* / *'//包含文件夹内的内容Reports目录
archiveName' Reports.zip'
destinationDir(file('/ dir1 / dir2 / dir3 /'))
}


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'
}

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/'))
}

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

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