How to make work together an Ant filelist inside an Ant copy

此生再无相见时 提交于 2020-01-04 05:22:05

问题


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 collection

Resource 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!