Alessandro Lacava’s Blog

Google
 

June 4, 2007

How to exclude subversion hidden directories (.svn) using Ant

Filed under: Computer, Java — alessandrolacava @ 12:43 pm

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:

XML:
  1. <zipfileset dir="${basedir}" excludes="**/.svn/*" prefix="${ant.project.name}"  />

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