Alessandro Lacava

on Designing and Developing Software. In love with Functional Programming.

How to Exclude Subversion Hidden Directories (.svn) Using Ant

Many Java developers already know that Ant is a great build tool. Besides a build tool you also need a good version control system to manage the various versions of your code. For this purpose I often use Subversion. Now, there might be time when you need to exclude the Subversion hidden directories from, for example, a backup Ant target you built. To do that you just need to use the following attribute to your zipfileset or other directory-based task:

<zipfileset dir="${basedir}" excludes="**/.svn/*" prefix="${}" />

In particular, the previous code excludes all the .svn directories, that are under the basedir directory and its subdirectories, recursively.