A while ago I posted my interest in using Groovy instead of ant for scripting my build file. I spent the last couple of days working on this. I thought people might be interested in my results.
Summarizing my previous post, I don't like ant because I don't like XML. I think that's about all the important points...
I have two comparable build files, though they do not perform identically. Here's a comparison of them based on size:
dusty:~ $ wc build.groovy build.xml 138 319 3630 build.groovy 158 584 6262 build.xml
The xml build file has 20 more lines, and almost twice as many words and characters as the groovy build file. In other words, a groovy build file is less typing, although you would tend to press the enter key about an equal number of times.
Here are the two files, for visual comparison (NOTE: I removed some targets from the xml file that haven't been implemented in the groovy script yet, but they still aren't identical): http://www.buchuki.com/misc/build.xml http://www.buchuki.com/misc/build.groovy
Unfortunately, firefox won't syntax-highlight the groovy file. Aside from that, which one do people think is easier to read? I personally prefer the groovy markup, but maybe I'm strange.
The main observation I found coding the groovy file is that its much easier to reduce duplication of code in a groovy script (just toss it in a method) than in an ant file (put it in a target and depend on it, sometimes conditionally). Also, its easier to group properties together into maps and having generic code manipulate them. This reduces both the number of total properties and the total amount of code.
Most articles I've read have been anti-groovy scripting, and I doubt this would become a standard either within the Java community (ie: where ant currently dominates) or across all projects that need build management. I just find it interesting, and I must confess that I prefer it.