Friday, February 18, 2011

Ant - If and Unless

Apache Ant support condition for target tag and they are if and unless


Above show an example of unless and if usage on target task. You may ask, when to use it? You can phase it as follow with the above example

if -> the update target will ONLY be performed if should.update variable is true

That is, if should.update is defined by either as property tag or as argument input
-Dshould.update="true", the update target will be called

unless -> the update target will ALWAYS be performed unless shouldnot.update is true

That is, if shouldnot.update is defined by either as property tag or as argument input
-Dshouldnot.update="true", the update target will be called

if and unless are extremely useful to control when to perform the target task.

No comments:

Post a Comment

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to  rec...