DirSet

A DirSet is a group of directories. These directories can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of PatternSets and Selectors.

PatternSets can be specified as nested <patternset> elements. In addition, DirSet holds an implicit PatternSet and supports the nested <include>, <includesfile>, <exclude> and <excludesfile> elements of <patternset> directly, as well as <patternset>'s attributes.

Selectors are available as nested elements within the DirSet. If any of the selectors within the DirSet do not select the directory, it is not considered part of the DirSet. This makes a DirSet equivalent to an <and> selector container.

Attribute Description Required
dir The root of the directory tree of this DirSet. Yes
includes A comma- or space-separated list of patterns of directories that must be included; all directories are included when omitted. No
includesfile The name of a file; each line of this file is taken to be an include pattern. No
excludes A comma- or space-separated list of patterns of directories that must be excluded; no directories are excluded when omitted. No
excludesfile The name of a file; each line of this file is taken to be an exclude pattern. No
casesensitive Specifies whether case-sensitivity should be applied (true|yes|on or false|no|off). No; defaults to true.
followsymlinks Shall symbolic links be followed? Defaults to true. See fileset's documentation. No
erroronmissingdir Specify what happens if the base directory does not exist. If true a build error will happen, if false, the dirset will be ignored/empty. Defaults to true. Since Apache Ant 1.7.1 (default is true for backward compatibility reasons.) No

Examples

<dirset dir="${build.dir}">
  <include name="apps/**/classes"/>
  <exclude name="apps/**/*Test*"/>
</dirset>

Groups all directories named classes found under the apps subdirectory of ${build.dir}, except those that have the text Test in their name.

<dirset dir="${build.dir}">
  <patternset id="non.test.classes">
    <include name="apps/**/classes"/>
    <exclude name="apps/**/*Test*"/>
  </patternset>
</dirset>

Groups the same directories as the above example, but also establishes a PatternSet that can be referenced in other <dirset> elements, rooted at a different directory.

<dirset dir="${debug_build.dir}">
  <patternset refid="non.test.classes"/>
</dirset>

Groups all directories in directory ${debug_build.dir}, using the same patterns as the above example.

<dirset id="dirset" dir="${workingdir}">
   <present targetdir="${workingdir}">
        <mapper type="glob" from="*" to="*/${markerfile}" />
   </present>
</dirset>

Selects all directories somewhere under ${workingdir} which contain a ${markerfile}.