Integrating Groovy into the build process using Ant

Apache Ant (http://ant.apache.org/) was one of the first build tools that appeared within the Java ecosystem, and it is still widely used by many organizations around the globe.

In this recipe, we will cover how to compile and test a complete Groovy project using Apache Ant. At the end of the recipe, we will show you how to use Groovy from within Ant to add scripting to a build task.

Getting ready

For demonstrating the build tool integration, let's create the following folders and files:

src/main/groovy/org/groovy/cookbook
    DatagramWorker.groovy
    MessageReceiver.groovy
    MessageSender.groovy
src/test/groovy/org/groovy/cookbook
    MessageProcessingTest.groovy

The aim of the project is to create a very simple ...

Get Groovy 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.