<< August 24, 2003 | Home | August 26, 2003 >>

How Do I Do X in Ant

Questions of the form "How do I do X in Ant?" gets asked on the ant-user mailing lists quite often. Usually it involves something that is platform specific but quite trivial on one platform but not on another platform.

There are four canned answers:

  • This is a platform specific thing, don't do it!
  • Use such and such Ant task.
  • Write your own Ant task to do it, and contribute it to the Ant community.
  • Use the exec task.

Of these, the last appealed to the pragmatist in me. The first appealed to the purist in me. And I can live peacefully with either approach.

The second and third approaches makes me uneasy. The third one just adds a lot of busy work to the project without any practical benefit or gain.

The second approach should appeal to the Java partisan. But there's none of it left in me. As the number of such tasks (touch, for example) grows, Ant will become more and more heavy, less and less maintainable, and eventually collaps under its own weight.

Duncan started out with a "simple" roll-your-own replacement of the unwieldy and platform specific build tool with wrinkles. We end up with a combination shell + build tool that does neither very well.