如何用ant 1.6替换<condition>中的嵌套<resourcecount>?</condition> </resourcecount>

时间:2009-07-13 15:33:08

标签: ant

我正在使用Ant 1.6和cannot use a "resourcecount" within a "condition"。基本上,我想根据正则表达式检查FileSet是否包含元素:

<condition property="foo.exist">
   <resourcecount when="greater" count="0">
     <filelist dir="." files="*foo*" />
   </resourcecount>
</condition>

通常,如果当前目录在名称中包含模式“foo”,则会分配属性foo.exist。 但我不能在蚂蚁1.6中做到这一点。

你有什么想法吗?

1 个答案:

答案 0 :(得分:2)

<path id="a">
    <fileset dir=".">
         <include name="*foo*"/>
    </fileset>
</path>

<property name="foo.exist" refid="a"/>

<echo>${foo.exist}</echo>
相关问题