问题
I would like to use the result of the following filelist (Ant):
<filelist id="docfiles" dir="doc">
<file name="foo.xml"/>
<file name="bar.xml"/>
</filelist>
into the following copy :
<copy todir="folder">
???
</copy>
I have already tried to put them together like:
<copy todir="folder">
<filelist id="docfiles" dir="doc">
<file name="foo.xml"/>
<file name="bar.xml"/>
</filelist>
</copy>
But Ant answer that FileLists is not supported in a such task. Thanks.
回答1:
As specified in the latest Ant copy task documentation:
Parameters specified as nested elements
fileset
or any other resource collectionResource Collections are used to select groups of files to copy. To use a resource collection, the todir attribute must be set.
Prior to Ant 1.7 only
<fileset>
has been supported as a nested element.
Since Resource Collections include:
- fileset, dirset, filelist, and path (and derivative types) expose file resources
- tarfileset can expose file or tarentry resources depending on configuration
- zipfileset can expose file or zipentry resources depending on configuration
- propertyset exposes property resources
A filelist
within a copy
element should work in Ant 1.7.
It will not be supported with Ant 1.6.x.
来源:https://stackoverflow.com/questions/569439/how-to-make-work-together-an-ant-filelist-inside-an-ant-copy