Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

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.


Error rendering macro 'link' : Link needs a name and a URL as arguments.
inside a Groovy script can make 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.


Error rendering macro 'link' : Link needs a name and a URL as arguments.
which in one simple concise file we have a JUnit test case that demonstrates the use of Ant inside Groovy along with testing that it actually works along with a demo of iterating through an Ant FileSet.
Notice that normal variables can be used to pass state into the Ant tasks and that Groovy code can be embedded anywhere in the markup.

Groovy Ant task

You can also use the Groovy Ant task.

Further Information

A few articles on the topic:

  • No labels