ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: AW: AW: how to access/iterate id in <script>
Date Thu, 04 Jan 2007 12:27:39 GMT wrote:

>> 2)
>> The java api of some types in ant were not really designed for 
>> ease of use.
> It's much easier to use <path> instead of <fileset>, e.g.
> Compare the execute()-implementation between [1] and [2].

ahh, but as of ant 1.7 everything is a resource, which is something you 
can iterate over. If you store everthing as resouce collections, you 
just get an iterator() and let the tasks sort the details out for 

the best bit, filesets have an iterator() method too, and
  class DirSet extends AbstractFileSet implements ResourceCollection

so if you get a dirset, you can call iterator() and get it to do all the 
heavy lifting.

Summary: use the resource collection APIs. If there is one limitation, 
it is that even though the ResourceCollection Types implement 
iterator(), they cannot implement the java.lang.Iterable interface to 
say "use us in foreach()", because of course that is java5+ only. This 
stops you going

  for(File d:dirset) {


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message