← Back to context

Comment by giamma

7 hours ago

Ant did not include IF THEN ELSE, unless you added the contrib package.

If you understood the paradigm, you could write branches in Ant files simply using properties and guards on properties ("unless"). Using IF in Ant was basically admission of not having understood Ant.

This said, I used Ant for a very limited amount of time.

It sure did, you use conditions, no need for contrib.

https://ant.apache.org/manual/Tasks/condition.html

The else part is easily done by repeating and negating the condition.

Two other advantages of Ant that MSBuild lacks in a sane way to this day, are macros, and proper documentation.

  • As of Ant 1.9.1, you can use 'if' and 'unless' attributes on any task or element in a target. I stopped using Ant a long time ago, but this was a pleasant discovery when I had to pick up an old Ant based project recently.

    https://ant.apache.org/manual/ifunless.html

    • Nice, I was basing my answer on what was there initially.

      I always liked Ant, as I don't suffer from XML allergy.