如何从 Ant 中以逗号分隔的目录列表制作文件集? [英] How do I make a fileset from a comma-separated list of directories in Ant?
问题描述
在 Ant 目标中,我得到一个属性,其中包含要包含在进一步操作(复制、过滤等)中的目录列表.它看起来像这样:
In an Ant target I get a property, containing the list of directories to be included in further action (copying, filtering, etc.). It looks like this:
directories=dir1, dir2, dir3
我需要一种方法来将此列表转换为选择所有这些目录中的文件的文件集或模式集.
I need a way to convert this list to a fileset or patternset that selects all the files in these directories.
我知道我可以使用脚本来生成模式字符串,然后在包含"或排除"中使用它,但是有没有办法避免使用脚本?
I know I can use a script to generate pattern strings and then use it in the "include" or "exclude", but is there are a way to avoid scripts?
推荐答案
请注意,从 Ant 1.9.4 开始,有一个新的结构
Note that as of Ant 1.9.4, there is a new construct <multirootfileset> that provides that functionality, even if the dirs are not siblings:
<multirootfileset basedirs="${directories}" includes="**/*">
这篇关于如何从 Ant 中以逗号分隔的目录列表制作文件集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!