Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude folder in gradle zip task

Tags:

gradle

I have a gradle zip task that looks like this:

task makeZipDev(type: Zip){
  from 'solr_config/solr_home'
  excludes  ['*/shop/product/data/' ]
  archiveName 'solr-home.zip'
  destinationDir(file('/docker/solr-dev/'))
}

I want to exclude everything the whole */shop/product/data/ folder from being zipped. And using excludes, as specified.

like image 946
pxr_64 Avatar asked Nov 06 '17 08:11

pxr_64


1 Answers

This is the way to go:

task makeZipDev(type: Zip){
  from 'solr_config/solr_home'
  exclude '**/shop/product/data/**'
  archiveName 'solr-home.zip'
  destinationDir(file('/docker/solr-dev/'))
}

or

task makeZipDev(type: Zip){
  from 'solr_config/solr_home'
  excludes = ['**/shop/product/data/**']
  archiveName 'solr-home.zip'
  destinationDir(file('docker/solr-dev/'))
}

Also, are you sure about destinationDir path? It starts under root?

like image 53
Opal Avatar answered Nov 14 '22 12:11

Opal