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
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Summary


In this chapter, we discussed how to create our own enhanced task. We also saw how to add the class definition in our build file and use it directly in the build.

If we put the task definition in the buildSrc directory of a Gradle project or multi-project build, we can reuse the task in the context of the Gradle build. Also, we now have a good separation of the definition and configuration of the task.

Then, we discussed how to publish the task as an artifact to a repository. Other projects can include the task in their classpath using the buildscript{} script block. Then, we can configure and use the task in the project.

In this chapter, we also discussed how to write our own Gradle plugin. We have seen how to add a plugin class to our Gradle build file. Then you learned using the buildSrc directory and place the source code of the plugin there.

Finally, to make the plugin really reusable in other projects, we put the plugin code in a separate project. The plugin code is then packaged...