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!
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With