Preface

Introduction

This book has a very clear aim: introduce you to the incredible simplicity and power of Gradle.

Gradle is a flexible yet model-driven JVM-based build tool. Gradle acknowledges and improves on the very best ideas from Make, Ant, Ivy, Maven, Rake, Gant, Scons, SBT, Leinengen, and Buildr. The best-of-breed features previously scattered among a set of tools are now made available via a unified Groovy DSL for scripting and Java API for tooling. Gradle, even at the 1.0 milestone release current as of the time of this writing, already has a passionate following among some of the most respected enterprises and open source communities.

As we explore the tool’s capabilities, you’ll discover that Gradle is being heralded as more than just a build tool but also as a means of automating the compilation, test, and release process. In this first official book on this open source project, we’ll showcase why the excitement around Gradle is on the rise and how it meets the challenge of these lofty build automation goals. Future volumes will cover the Gradle plug-in ecosystem, how to extend Gradle with your own build logic, and even more advanced topics. We’re excited to have you along for the ride.

Tim Berglund and Matthew McCullough

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

All the code samples used in this book in addition to many others that supplement this learning effort can be found, fully open sourced, at https://github.com/gradleware/oreilly-gradle-book-examples

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Building and Testing with Gradle by Tim Berglund and Matthew McCullough (O’Reilly). Copyright 2011 Gradle, Inc., 978-1-449-30463-8.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly.

With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features.

O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at http://my.safaribooksonline.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://www.oreilly.com/catalog/0636920019909

To comment or ask technical questions about this book, send email to:

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments from Tim Berglund

I’m delighted to be a part of this, the first book on Gradle to be available to the marketplace. It’s not every day that a game-changing technology comes along, and it’s exciting to be a small part of one when it does. Gradle is just such an opportunity for everyone reading this book.

Writing a book is enormously difficult work, even when it’s a small one and you share the load with a coauthor. I should start by thanking that coauthor, Matthew McCullough, for his organization, motivation, willingness to hold me accountable, and of course his excellent contributions to this volume.

I would also like to thank Hans Dockter, Ken Sipe, Adam Murdoch, Peter Niederwieser, Szczepan Faber, and Luke Daley of the Gradleware team for their support in answering questions and providing feedback during the writing process. The technical accuracy of this volume would be dramatically compromised without them.

Thanks to Mike Loukides for his confidence in Gradle as a technology and his help in publishing this book under O’Reilly’s name. Thanks also for the editorial contributions of Meghan Blanchette and Jasmine Perez.

The book also would not have been possible without the support of Jay Zimmerman of the No Fluff Just Stuff conference series. In five years, when Gradle has brought peace and order to all of your builds in ways you never could have anticipated, and you look back and realize you learned it all from these books, send Jay an email to say thanks. He won’t know why you’re sending it, but you will.

Finally, I want to thank my wife, Kari. I could have been called to other kinds of work which would have imposed less of a burden on her and conformed better to the assumptions she once made about what it is her husband would do, but instead she got this. Nevertheless, she believes in me and supports me in my vocation, including things like the writing of this book. These things likely would not happen if she hadn’t.

The project of explaining Gradle continues, and these acknowledgments will follow it in the future volumes.

Acknowledgments from Matthew McCullough

Rich Remington for his detailed book review and edits.

Ken Sipe for his structural suggestions and content review.

Chris Beams for his legitimizing of Gradle through SpringSource projects.

Hans Dockter for his edits, but equally for his coinvention of this incredible new tool and belief that it can be stretched even further.

Adam Murdoch for his coinvention and equally meaningful technical edits of the book.

Tim Berglund for his sharing of the effort on authoring this book.

Jay Zimmerman for his encouragement and multifacted support of this technological and educational endeavor we call Gradle.

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.