I converted dbcdb’s build system from Make to ant a couple of days ago: besides ant being on my list of tools to learn about, it seems to be impossible for Make to work well with Java. Previously, I’d gotten around this by using a Makefile that works 99% of the time, and having my first acceptance test do a make clean; make all. Which, actually, worked well enough – the project is small enough that rebuilding from scratch takes something like five seconds – but there’s no excuse for not getting your dependencies right.
Upon converting to ant, however, I ran into an unpleasant surprise: my acceptance tests were taking two or three times longer to run! After some digging around, I found the issue – each acceptance test had been doing a make, which I’d replaced by running ant, and it turns out that it takes ant about three seconds just to figure out that it doesn’t have to recompile anything. So I’d replaced one 5 second delay by seven 3 second delays; oops. (Actually, it was made worse because of a problem in my ant usage; those are the numbers after I fixed the problem.) After a bit of hemming and hawing, I’ve decided to remove the ant calls from the acceptance tests other than the first one; hardly a satisfactory solution.
Of course, an ant maven would tell me that the right thing to do is to have the acceptance tests be run from within ant, at which point dependency checking would solve that problem. Which is absolutely correct, if I were sure that I’m going to stick with ant in the long term. But I’m not at all sure of that: at some point, I’m going to switch the project to another language (Ruby is the current leading candidate), at which point I won’t have any obvious reason to stick with ant. (To confuse matters further, Ruby also has its own make replacement.) I’ll definitely add a task to run the unit tests though; it is nice that all the ant guides talk about JUnit right up front.
I’m also a bit nonplussed by the fact that Emacs isn’t handling editing the build.xml file properly; it looks like its xml mode might do better if there were a DTD that I could point it at, but apparently such a beast doesn’t exist for ant, because the language is extensible. So I have to hand-indent it, which is barbaric. Don’t get me wrong, that’s more Emacs’s fault than ant’s fault, but it’s still pretty annoying. I’m sure there’s a solution out there, but right now I’m not feeling motivated enough to go find it; I’ll limp along until it either becomes more of a problem or vanishes entirely. And I’m still make-centric enough to be not entirely comfortable with ant: for example, its lack of small-scale targets bothers me. What if I just want to compile one of my .java files (plus its dependencies, of course), not the whole batch? (Though I just read a possible solution to that, using properties.)
Post Revisions:
There are no revisions for this post.