Ant-驱动属性值的多个条件

Ant-驱动属性值的多个条件,ant,properties,conditional-statements,multiple-conditions,Ant,Properties,Conditional Statements,Multiple Conditions,我试图在Ant检查目标中添加多个AND条件来设置属性。我想根据设置的属性执行某些操作 <target name="checkVal"> <condition property="val.present"> <and> <available file="${srcDir}/somefile"/> <matches pattern="MyClass.java" string=

我试图在Ant检查目标中添加多个AND条件来设置属性。我想根据设置的属性执行某些操作

<target name="checkVal">
    <condition property="val.present">
        <and>
            <available file="${srcDir}/somefile"/>
            <matches pattern="MyClass.java" string="${pathString}"/>
        </and>
    </condition>
    <fail message="Failing the condition."/>
</target>

<target name="doSomething" depends="checkVal" if="val.present">
    ...
</target>

有人能告诉我如何才能做到这一点吗?

在我用
包含
任务替换
匹配
任务后,它起作用了

<target name="checkVal">
    <condition property="val.present">
        <and>
            <available file="${srcDir}/somefile"/>
            <contains substring="MyClass.java" string="${srcDir}"/>
        </and>
    </condition>    
</target>

<target name="checkVal">
    <condition property="val.present">
        <and>
            <available file="${srcDir}/somefile"/>
            <contains substring="MyClass.java" string="${srcDir}"/>
        </and>
    </condition>    
</target>