I am reminded why I hate Ant

Whenever I come across a build.xml file, I think "oh no, newbies!" and wonder if there isn't some other code I could be looking at/using. Sun's JDIC is a prime example of Ant madness. That project has the worst build system I've come across, and that includes people who write .bat files or type javac *.java each time.

Last night, I was building GNU cp-tools. They use Ant. I have to edit build.xml to specify 1.4 source before it will build at all, but my editor's clever/stupid enough to use build.xml if it can't find a makefile, so I basically forget I'm having to use Ant, and just hit C-B to build like always.

Forget about Ant, that is, until I get my first NoSuchMethodError and it takes me a few seconds to realize that Ant's just screwed me. It's been carefully wasting time each build, working out which files have changed, so it only asks for those files to be recompiled, as if that made any sense.

So if I remove/rename/change the signature of a method, I have to manually clean before building. In 2004.

Likewise if I remove/rename/change the signature/change the value of a constant field. Changing the value is the worst because the VM can't notice at run-time if you're using inconsistent values of a constant field. When they're inlined, they're inlined without any indication of where they came from. That's Java's fault, not Ant's, but the proper defense is to either really understand Java dependencies or always build from scratch (which is cheaper anyway up to a few hundred classes).

So: Ant's slower, less powerful, less useful for other tasks, arguably at least as hard to write instructions for (at least make(1) uses a relatively small and simple set of primitives, rather than a different ad hoc solution for each problem, which may not include the problem you're facing), and it behaves incorrectly for the one language it's supposed to understand!


You couldn't come up with something this bad if you were one of the authors of MS Outlook and deliberately set out to do a bad job. Maybe that's it... Surely Ant must be part of an MS ploy to discredit Java?