If you look at Ant's own build.xml, you can see that the PatternSet with the id "chmod.patterns" is defined in a <chmod> task in target main and referenced twice later on. This makes the <chmod> in main special.
I feel, it would be much more natural to define the patternset somewhere outside the task and use a <patternsetref> in the first <chmod> as well. The same holds true for FileSets or PATH like structures that get used more than once. I've added infrastructure needed to have <path>, <patternset> and <fileset> elements in the build.xml with my last patch. Only ProjectHelper is not aware of this yet. Given that the reference mechanism in Ant is a global one (and antstructure claims it would sit on top of the XML ID attribute type - which means the id must be unique 8^), I'd say make <path> and friends a sibling of <target> and only allow them to be placed there and not inside of <target>s. This would avoid the confusion of <property> as well. What do you think? Stefan
