Gradle task to create a zip archive of a directory

2019-02-06 04:25发布

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?

1条回答
唯我独甜
2楼-- · 2019-02-06 05:00

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/'))
}
查看更多
登录 后发表回答