Stephen Cook
Stephen Cook

Reputation: 181

Ant Zip Task, many excludefiles in subdirectories

I'm looking to use Ant to build a project, everything into a .zip file.

Ant's Zip task has an excludefiles attribute - but I was looking for functionality more similar to the .gitignore file in that it collects more excludes as it is copying from subdirectories.

For example, if I had the following structure

toBuild
|--a
|  |--.ignores
|  |--File1.txt
|  |--File2.txt
|  +--File3.txt
|--b
|  |--.ignores
|  |--File1.txt
|  |--File2.txt
|  +--File3.txt
|--.ignores
|--File1.txt
|--File2.txt
+--File3.txt

With:

Then the output would be

builtZip
|--a
|  +--File2.txt
|--b
|  +--File1.txt
|--File1.txt
+--File2.txt

What would be the best approach to something similar to this?

Upvotes: 0

Views: 72

Answers (1)

user589555
user589555

Reputation:

Sounds like a good use case for custom selectors:

http://ant.apache.org/manual/Types/selectors.html#customselect

You'll probably need to write your own selector as explained here:

http://ant.apache.org/manual/Types/selectors-program.html

Upvotes: 1

Related Questions