Anand
Anand

Reputation: 2359

How to put two conditions in ANT Target?

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?

Upvotes: 3

Views: 3010

Answers (1)

JB Nizet
JB Nizet

Reputation: 691625

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}">
    ...
/>

Upvotes: 2

Related Questions