I have a simple gradle zip task,
I found out any files starting with .# from input folder are ignored
task zipIt(type: Zip) {
from 'input/'
archiveName = 'output.zip'
}
Does someone knows why is so? And how can I override this behavior so I include those files in the zip?
Later edit: Adding the file pattern explicitly doesn't seem to help
On the other hand, looking over @opal links led me to a solution:
import org.apache.tools.ant.DirectoryScanner
task zipIt(type: Zip) {
doFirst{
DirectoryScanner.removeDefaultExclude("**/.#*")
}
from 'input/'
archiveName = 'output.zip'
}
Expounding on Opal's answer, Gradle uses ANT's default excludes which are as follows:
As of Ant 1.8.1 they are:
**/*~
**/#*#
**/.#*
**/%*%
**/._*
**/CVS
**/CVS/**
**/.cvsignore
**/SCCS
**/SCCS/**
**/vssver.scc
**/.svn
**/.svn/**
**/.DS_Store
Ant 1.8.2 adds the following default excludes:
**/.git
**/.git/**
**/.gitattributes
**/.gitignore
**/.gitmodules
**/.hg
**/.hg/**
**/.hgignore
**/.hgsub
**/.hgsubstate
**/.hgtags
**/.bzr
**/.bzr/**
**/.bzrignore
The .# is by default excluded. Updating your build.gradle file with a task similar to the following should allow you to overwrite the default excludes.
task copyPoundFiles(type: Copy) {
from '/path/to/files'
into '/dest/for/files'
include '**/.#*'
}
As far as I remember gradle used the same default excludes as ant does. Have you tried including the file explicitly?
Please have some further reading here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With