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 UDP client/server and accompany it with a unit test.
The base class for the server and the client, DatagramWorker
, has the following code:
abstract class DatagramWorker { byte[] buffer = new byte[256] DatagramSocket socket =...