web-dev-qa-db-ja.com

ディレクトリのZipアーカイブを作成するGradleタスク

ディレクトリのZipアーカイブを作成するgradleタスクがあります。 gradleタスクは次のとおりです。

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

「gradle archiveReports」コマンドを実行すると、ビルドの表示が成功します。ただし、Zipファイルは作成されません。

ここに何かが足りませんか?

24
Praveen

私はこのための方法を考え出した:それは今私のために働いています。

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