Chapter 5. Build processes
This chapter covers
- Adding Groovy to Ant builds
- Using Maven with Groovy
- Groovy Grapes and @Grab
- The future: Gradle
Building source code is almost always a pain point in development organizations. An ideal build process is automated end-to-end, including compilation, running tests, generating reports, and producing any required artifacts. The process needs to be fast enough that it can be done frequently, especially given modern agile approaches, and yet flexible enough to adapt to the exigencies of individual teams.
In the Java world two primary approaches to automated builds have emerged over time. Both are open source projects from Apache. The first is Ant (http://ant.apache.org), which uses a library of tasks configured in XML backed by Java classes. The other is Maven (http://maven.apache.org), which offers a rich array of options and promises to make the entire process simple, but uses a highly opinionated API that requires a degree of mastery to use effectively.
To start I want to address the goals of any build process, and then see how the various tools attempt to meet them.
A software build combines several features that individually seem like they ought to be easy but in practice become complicated. To build your code you must