Book Image

Gradle Effective Implementations Guide - Second Edition

By : Hubert Klein Ikkink
Book Image

Gradle Effective Implementations Guide - Second Edition

By: Hubert Klein Ikkink

Overview of this book

Gradle is a project automation tool that has a wide range of applications. The basic aim of Gradle is to automate a wide variety of tasks performed by software developers, including compiling computer source code to binary code, packaging binary codes, running tests, deploying applications to production systems, and creating documentation. The book will start with the fundamentals of Gradle and introduce you to the tools that will be used in further chapters. You will learn to create and work with Gradle scripts and then see how to use Gradle to build your Java Projects. While building Java application, you will find out about other important topics such as dependency management, publishing artifacts, and integrating the application with other JVM languages such as Scala and Groovy. By the end of this book, you will be able to use Gradle in your daily development. Writing tasks, applying plugins, and creating build logic will be your second nature.
Table of Contents (18 chapters)
Gradle Effective Implementations Guide - Second Edition
About the Author
About the Reviewer

Using the Gradle Wrapper

Normally, if we want to run a Gradle build, we must have Gradle installed on our computer. Also, if we distribute our project to others and they want to build the project, they must have Gradle installed on their computers. The Gradle Wrapper can be used to allow others to build our project even if they don't have Gradle installed on their computers.

The wrapper is a batch script on the Microsoft Windows operating systems or shell script on other operating systems that will download Gradle and run the build using the downloaded Gradle.

By using the wrapper, we can make sure that the correct Gradle version for the project is used. We can define the Gradle version, and if we run the build via the wrapper script file, the version of Gradle that we defined is used.

Creating wrapper scripts

To create the Gradle Wrapper batch and shell scripts, we can invoke the built-in wrapper task. This task is already available if we have installed Gradle on our computer. Let's invoke...