0

I'd like a target to execute if either of two conditions are met. Can you have two unless evaluated for one target? Essentially, I'd like target not to run if either of these are true:

unless="product.is.x" or "product.is.y"

Sorry if I'm going about this in all the wrong way, I'm somewhat new to Ant.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
Rob
  • 123
  • 2
  • 9
  • Duplicate of http://stackoverflow.com/questions/18097555/execute-ant-task-if-two-conditions-are-met. Basically create a new property that combines the two with or, and use it in unless. – JP Moresmau Apr 14 '15 at 19:53

1 Answers1

1

Read about targets where they mention exactly how to do it:

A target also has the ability to perform its execution if (or unless) a property has been set.

In your case, you can do like:

<condition property="myTarget.condition">
    <or>
        <equals arg1="${product.is.x}" arg2="true" />
        <equals arg1="${product.is.y}" arg2="true" />
    </or>
</condition>

...

<target name="myTarget" unless="myTarget.condition">
    ...
M A
  • 71,713
  • 13
  • 134
  • 174