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

Creating a sample project

Before we can see the support for Gradle in the several continuous integration servers, we need to have a sample project. We are going to create a very simple Java project with a test class and add it to a Git repository in this section.

We have already created a Java project earlier. We are going to reuse the code in this chapter for our sample project. We want a test in our project so that we can see how the continuous integration tools can handle test results. Finally, we want more than one artifact for our project; we also want a JAR file with the compiled classes, source code, and Javadoc-generated documentation.

  1. We will first create a build.gradle file in a directory with the following contents:

            // We create a Java project so we need the Java plugin 
            apply plugin: 'java' 
            // Set base name for archives. 
            archivesBaseName = 'gradle-sample' 
            // Version of the project.