Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What files are excluded by default from Ant zip task?

Tags:

java

zip

ant

I'm running an Ant zip task to zip the whole contents of a directory on Unix systems:

<zip destfile="${deploy}/test.zip">
    <zipfileset dir="/home/mydir" />
</zip>

After the zip is created, and checking the contents, I can see that some config files, Visual Studio specific files and others like the Mac OS .DS_STORE file are left out the zip.

Is there any rule ant follows to decide what files will not be included?

I need to know in advance since I need to create a list of existing files on that directory before zipping (currently using Java). Right now I'm excluding all directories and hidden files (using File.isHidden() and isDirectory() methods) , but the list is still getting some of the file Ant lefts out (for example, vssver.scc

like image 282
Dan Avatar asked Jun 15 '11 00:06

Dan


1 Answers

From the docs, or use Konstantin's solution to inspect your particular installation:

There are a set of definitions that are excluded by default from all directory-based tasks. 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 folllowing default excludes:

 **/.git
 **/.git/**
 **/.gitattributes
 **/.gitignore
 **/.gitmodules
 **/.hg
 **/.hg/**
 **/.hgignore
 **/.hgsub
 **/.hgsubstate
 **/.hgtags
 **/.bzr
 **/.bzr/**
 **/.bzrignore
like image 162
Zac Thompson Avatar answered Nov 07 '22 01:11

Zac Thompson