Chapter 3. Ant and Gradle
When considering leveraging an existing investment in Apache Ant, or perhaps
using the broad set of tasks that the Ant community has created, Gradle
has a great story to tell. Gradle offers a complete superset of Ant. In
fact, it makes Gradle’s use of Ant simpler than directly using Ant, partly
by leveraging Groovy’s AntBuilder
functionality. Gradle brings in everything from the Ant namespace into the
Gradle namespace such that using a core Ant task is as easy as calling
ant.<taskname>
.
Discussing the usage of Ant from Gradle provides a great bridge in terms of progressive migration to a pure Gradle strategy. Over time though, we believe you’ll desire to standardize on the more powerful Gradle feature set by using native Gradle components or by wraping any Ant behavior in a Gradle plug-in. The latter maintains the value of the functioning Ant behavior while fully enabling build-by-convention throughout the updated Gradle build ecosystem. With full awareness of the quantity of existing Ant infrastructure and value of leveraging it via the new build tool, Gradle ships with a full copy of Ant, thus making Ant’s default tasks available to every Gradle build. To aid with this mind-set remapping, we’ll discuss how Gradle compares to Ant, providing parallels in the approaches to writing builds and to each tool’s unique terminology.
The Vocabulary
Gradle is occasionally described as a Groovy-based Ant. That would be the role that Gant fills, but Gradle has much more ...
Get Building and Testing with Gradle 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.