New Book Review: "Gradle Essentials"

New book review for Gradle Essentials, by Kunal Dabir and Abhinandan, Packt Publishing, 2015, reposted here:

Gradle_essentials

Stars-4-0._V192240704_

The only relatively recently published (circa early-2018) text on mastering Gradle fundamentals. Although I have been a long-time Apache Maven user, I admittedly resisted a move to Gradle a few years ago when some of my colleagues had done so, mainly because they could not explain any benefits of using it other than commenting that project dependencies are relatively terse with Graven compared to Maven, which in my opinion did not justify a switch in itself. While I still view Apache Maven as the de facto build automation tool for Java projects, I was recently in a position where Gradle had been preemptively chosen for a development project and I needed to get up to speed using it in conjunction with IntelliJ IDEA (as is the case with Maven, I have also been a long-time Eclipse user). In working through this book, I fortunately discovered that Gradle provides more benefits than just dependency management.

To ramp up on Gradle, I got going by working through the first 5 of 9 chapters provided, and then following up by working through real projects, although I did end up skimming through the last 4 chapters to get familiar with the content that these provide. Developers interested in reading through this book will likely have differing needs, as is the case with most technology texts. For example, usage of the Jenkins automation server and SonarQube static code quality analysis platform that can be used with Jenkins is briefly covered, and I glossed over this content due to my extensive usage of both tools (including Jenkins from its early days several years ago when it was called Hudson). I also took a look at what the authors had to write about migrating from Apache Maven to Gradle, but what they provide is only 2-pages of content. While it has been a long time since I've used Apache Ant to any great extent, some readers might be interested in the pages covering a move from Ant to Gradle in the preceding pages, but 4-pages of material will likely only go so far.

Most of the exercises covered in the first 5 chapters worked as intended, although I soon came across Gradle version related differences that begin at the tail end of chapter 1. For example, executing the code at the top of page 12 resulted in the following message: "The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0." And executing the code presented in the 1-page discussion of the benefits of using the Gradle Daemon does not result in the output provided by the authors. As I was curious why this was the case, I referenced the Gradle user guide which states the following: "The Gradle Daemon is enabled by default starting with Gradle 3.0, so you don't have to do anything to benefit from it."

Other than some other anomalies, such as inconsistent versions of JUnit being used in chapter 2 examples (sometimes JUnit 4.11, sometimes JUnit 4.12), some potential users of this guide might be interested in knowing that the primer the authors provide in chapter 4 starts off on the wrong foot in the initial section entitled "Running Groovy code": the authors state several times that "we can use" this and "we can use" that, but they don't actually show you how to do the listed tasks. For example, I needed to look up how to install the latest Groovy SDK locally, as well as how to execute the Groovy console GUI at the command line using "groovyConsole". I don't think it's too much to ask the authors to include the few additional lines of code needed to perform these tasks, or at least to point readers in the right direction by providing URLs for additional information.

When all is said and done, I recommend this book because it is a relatively quick guide to work through, and the issues previously mentioned don't seriously distract from what is presented. If anything, these will force readers to not go through the motions of understanding the material, and will additionally get readers to get more familiar with the Gradle documentation and community. As explained by the authors midway through the text, Gradle build scripts use the Groovy syntax as well as a rich and expressive DSL that provides high-level abstractions to represent common build-related logic. As a final note, I recall when Groovy reached peek popularity several years ago when my colleagues started writing scripts with the language. However, it has recently become so closely tied to Gradle usage that I recently overheard a developer at work commenting how "Groovy is a DevOps language", even though it has been around for quite some time: making this same mistake will likely expose your relative inexperience to more senior resources around you.

Subscribe to Erik on Software

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe