Ant dirset, which includes the root directory

How to define a dirset in Ant, which includes two directories: the base directory of the project and the subdirectory "test"?

It looks like you cannot specifically specify the dirset root directory using either "/", ".", Or ". For example, this includes." / test "but not". ":

<dirset dir="." id="myDirs"> <include name="." /> <include name="test" /> </dirset> 
+4
source share
2 answers

This clearly does not make sense. After the root directory is included, the test subdirectory is included in everything else. Maybe you need to tell us what this dirset will consume and what do you expect from it? Process "test" twice?

Based on your comment, you need to add root, and then add the 'exclude' elements for everything in the root except the test.

Or make two dircets: one with a root, excluding all children, and the other only with a dough.

+2
source

The DirSet documentation does not explain this behavior, but the following works on my Ubuntu 15.04 with ant version 1.9.4

 <path id="my.two.dirs"> <dirset dir="." id="myDirs1" excludes="*/**" /> <dirset dir="." id="myDirs2" includes="test" /> </path> 

This is pretty much what bmargulies posted in his answer, but since I didn't understand it at first, I thought a code example might be useful.

+2
source

All Articles