3

My need is to check two conditions in my ANT Target. If either of them is true the ant target must execute.

<target name="generateArtifacts" if="${generateABC}" or if="${generatePQR}">
...
/>

The above syntax in WRONG. How to make it correct?

Anand
  • 2,239
  • 4
  • 32
  • 48

1 Answers1

2

Maybe there's something simpler, but the following would do, I think:

<condition property="artifactsMustBeGenerated">
    <or>
        <isTrue value="${generateABC}"/>
        <isTrue value="${generatePQR}"/>
    </or>
</condition>

<target name="generateArtifacts" if="${artifactsMustBeGenerated}">
    ...
/>
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • This doesn't work unless the condition is inside a target and the "generateArtifacts" target depends on that target. – pacoverflow Aug 05 '14 at 15:55