tags:

views:

31

answers:

2

I feel like I'm missing something obvious at the moment. I want to collect a set of dirs / files together in ANT. I know I can do it using a fileset with an optional patternset inside it, but that involves searching for files based a specific criterior - filetype, name etc.

I already know the paths to the files I want to collect. I have n properties which reference these paths. I want a way to collect these paths in a fileset, though I cannot find a way to do it.

This represents what I want to achieve (I know it isn't valid code, but hopefully it will describe what I mean):

<fileset>
   <path>${src.dir}</path>
   <path>${test.dir}</path>
   <path>${third.party.src.dir}</path>
   <path>${bin.dir}</path>
   <path>${docs.build.txt}</path>
</fileset>
+1  A: 

You could try using a files element.

<files>
  <include name="${src.dir}/**/*.*">
  <include name="${test.dir}/**/*.*">
  <include name="${third.party.src.dir}/**/*.*">
  <include name="${bin.dir}/**/*.*">
  <include name="${docs.build.txt}">
</files>
madgnome
A: 

Thanks for the answer which works fine, however I managed to achieve the same thing even more simply using path with nested pathelements:

<path
   id="srcdirs">
   <pathelement location="${src.dir}"/>
   <pathelement location="${test.dir}"/>
   <pathelement location="${assets.dir}"/>
</path>
1ndivisible