Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine filesets using Ant

Tags:

I have 2 different filesets defined in Ant as follows:

<fileset id="fileset1" dir="${classes.dir}"> </fileset>  <zipfileset id="fileset2" src="myArchive.zip" includes="**/*.class"> </zipfileset> 

I want to create a third fileset which is the union of both the above filesets

<fileset id="merged"> </fileset> 

Can someone tell me how to do this ? Is it even possible to do something like that ? Thanks in advance!

like image 420
Kryptic Coder Avatar asked Jul 12 '11 05:07

Kryptic Coder


2 Answers

One way to do this is with Ant resource collections, in particular a union.

<fileset id="fileset1" dir="${classes.dir}" /> <zipfileset id="fileset2" src="myArchive.zip" includes="**/*.class" />  <union id="onion">     <resources refid="fileset1" />     <resources refid="fileset2" /> </union> 

Then you can refer to the 'onion' anywhere you might use a fileset, e.g.

<copy todir="dest">     <resources refid="onion" /> </copy> 

I recommend using generic resources elements rather than filesets for maximum flexibility.

like image 160
martin clayton Avatar answered Oct 21 '22 16:10

martin clayton


Try this: I think it should work, since <fileset> is an implicit <patternset>.

<fileset id="fileset1" dir="${classes.dir}"> </fileset>  <zipfileset id="fileset2" src="myArchive.zip" includes="**/*.class"> </zipfileset> 

EDIT: odd. This perhaps?

<patternset id="merged">   <patternset refid="fileset1" />   <patternset refid="fileset2" /> </patternset> 
like image 40
Femi Avatar answered Oct 21 '22 17:10

Femi