Rod Hilton's Reviews > Building and Testing with Gradle

Building and Testing with Gradle by Tim Berglund
Rate this book
Clear rating

by
1499157
's review
Aug 05, 11

bookshelves: programming, have-hardcopy
Read in August, 2011

Building and Testing with Gradle is the first Gradle book on the market. It's really no surprise, then, that the book is incredibly short, a mere 90 pages including generous helpings of long code samples. This may seem like a complaint, but it's quite the opposite: Building and Testing with Gradle is incredibly short and very much to the point. It is intended as an introduction to Gradle, and it accomplishes that goal very well.

Within the next few months there will surely be another Gradle book, maybe a "Definitive Guide" or something similarly named. That book will contain every little detail of the Gradle build system, and it will probably be good for someone who really wants to understand the internals of Gradle. But Building and Testing with Gradle has the goal of getting the reader introduced to Gradle and using it in projects right away, so it doesn't muddy the informational waters by including anything other than the necessities of what someone needs to be productive.

The book can easily be read in a single sitting, and due to its organization it would work well as a handy cookbook-esque reference after the fact.

Gradle is in an interesting predicament: the 'build system' war was settled a while ago. People who want good dependency management and standardized builds use Maven. People who want flexibility and control use Ant (and usually with Ivy to add dependency management). Sometimes people who hear about Gradle respond with a "who cares?" The authors are well aware of this situation, and so they very quickly try to sell the reader on Gradle. Chapter 1 deals with how to set it up, and Chapter 2 deals with why you'd want to use it. Chapter 2 reads almost like a marketing slideshow, sort of presenting a random sampling of powerful Gradle features, but they are tied in well with the narrative of the chapter, which is explaining the underlying object model Gradle uses for tasks. By the end of Chapter 2, the authors hope your attitude is "okay, I like Gradle, and I want to start using it."

Chapter 3 immediately starts answering that question, focusing on Gradle's integration with Ant. Chapter 4 follows suit, doing the exact same thing but for Maven. After two short chapters on Testing and Hierarchical Builds, the book is over.

One of my biggest complaints about Gradle is that, because it enables writing code inside of a build (something that Maven makes damn-near impossible), I have to start worrying about testing my build code. Gradle doesn't have any kind of facility for unit-testing build scripts, and it doesn't supply any kind of file system mocking or anything like that, which leaves me somewhat concerned. Tim and Matt address this directly, saying that Gradle uses Groovy to parse the Gradle DSL, but it should not be used to write a great deal of code. Code belongs in separate Java or Groovy classes, which can be unit tested. I was very happy to see this, because I feel like Building and Testing with Gradle will be a lot of people's first Gradle book, so this advice starts the community out on the right foot.

I found the chapter on Multiproject Builds the most interesting (particularly because I have a multiproject system at work and would like to start using some of the methodologies discussed) but I'd have liked to see a bit more coverage of how well it plays with other build systems. The bulk of the book was devoted to discussing how Gradle plays with Ant and Maven, but I was left wondering if the only way to enable Multiproject Builds was to use Gradle in all subprojects. I have no concept of how it would handle a Grails project, either (though the book did give me enough of an understanding of Gradle that I'd know what to look for).

If you're curious about Gradle or eager to start using it within an already-existing project, Building and Testing with Gradle is the perfect book. It gives enough of the basics to get you comfortable with the system, and covers a lot of ground in terms of working Gradle into existing Ant or Maven builds, including a bit of discussion about migration strategy. It's the perfect length to pick up and get started right away, and it leaves out a lot of the nuts and bolts to avoid confusing the reader early-on. I know that Tim and Matt are writing followup volumes with more detailed looks at some aspects of Gradle, and I'm very excited to read those as well. I highly recommend this book for people looking to spice up their builds with Gradle.
1 like · likeflag

Sign into Goodreads to see if any of your friends have read Building and Testing with Gradle.
sign in »

No comments have been added yet.