If ever you've been working with a build.xml file or some Jelly script and found yourself a little restricted by all those pointy brackets, or found it a bit wierd using XML as a scripting language and wanted something a little cleaner and more straight forward, then maybe Ant scripting with Groovy might be what you're after.
Groovy has a helper class called
AntBuilder which makes the scripting of Ant tasks really easy; allowing a real scripting language to be used for programming constructs (variables, methods, loops, logical branching, classes etc). It still looks like a neat concise version of Ant's XML without all those pointy brackets; though you can mix and match this markup inside your script. Ant itself is a collection of jar files. By adding them to your classpath, you can easily use them within Groovy as is. We believe using
AntBuilder leads to more concise and readily understood syntax.
Below are some examples (most taken from Groovy's own AntBuilder tests) which demonstrate:
Compiling and running a Java file:
Sniffing around ...
Here is a small build file which uses the joint compiler to compile Groovy and Java source files together, and put them in WEB-INF/classes: