dcsimg
Execute a step in the target depending on a condition
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chi_Vu
Posted On:   Wednesday, June 9, 2004 07:48 AM

If a target includes multiple steps, for example, let's say creates a jar and then signs a jar. How can I tell Ant to skip the sign jar step if a certain condition is true?


The FAQ talks a bout skipping a target altogether if a condition is true, which does not quite answer my situation.


Chi

Re: Execute a step in the target depending on a condition

Posted By:   Mani_Iyer  
Posted On:   Wednesday, June 9, 2004 02:45 PM

In your case, you would do something like:





....



...sign the jar here....



The idea is to break up the tasks into targets which are governed by the if or unless attributes.
HTH.

Re: Execute a step in the target depending on a condition

Posted By:   Sean_Owen  
Posted On:   Wednesday, June 9, 2004 07:50 AM

Ant has specifically tried to avoid getting into "if" and "while" constructs, but they are necessary sometimes. Look at the task, which lets you set a property if certain conditions are true. You can then invoke a task which only executes if that property exists in order to achieve conditional execution.
About | Sitemap | Contact