Martin Fowler talks about make and Ant and how he thinks they are not appropriate for larger scale build systems:

Simple builds are easy to express as a series of tasks and dependencies. For such builds the facilities of ant/make work well. But more complex builds require conditional logic, and that requires more general programming language constructs - and that's where ant/make fall down.

He suggests that using a real programming language (he prefers Ruby) instead. If you really need conditional logic, you better use a real programming language, with that I wholeheartedly agree.

The approach of Ant to this is that you should use Java (or any scripting language supported by BSF) as the language and write a task. Instead of looping over a list of filenames and copy them one by one with a small and simple copy task, Ant has a more powerful task that hides the loop. The same is true for compiling, running JUnit tests and even executing external programs (<apply>).

This approach violates the KISS principle. Ant tasks are complex and sometimes unwieldy or even overtaxed with features. But look where kiss would lead you in this situation

  for file in list-of-files
  do
    cp $file destdir
  done
instead of
  <copy todir="destdir">
    <fileset .../>
  </copy>

If all you have is a programming language, things get difficult even for easy things. There certainly are things that are too simple to write a custom task for, but I've never encountered a build that really needed a for loop - I bet that Fowler's "complex" is an order more difficult than mine.

My general feeling is that Ant is on a good middle-ground between making simple things simple and enabling difficult things. It may not the best solution if things are really complicated, even though 1.6.0 will help a lot even then (<macrodef>, <subant> and <import>).

path: /en/Apache/Ant | #