Appendix A.  Using the Gradle Build Tool

Throughout this book, we have used Apache Maven as our build tool, but there are other popular build tools also used widely in the Java community. One such build tool is Gradle. Instead of XML, Gradle uses a Groovy-based Domain Specific Language (DSL) as the base for the build script, which provides more flexibility when defining complex build scripts. Compared to Maven, Gradle takes less time for incremental builds. So, Gradle builds are very fast and effective for large projects.

In this appendix, we will see how to install and use Gradle as the build tool in our project.

Installing Gradle

Perform the following steps to install Gradle:

  1. Go to the Gradle download page by entering the URL http://www.gradle.org/downloads in your browser.
  2. Click on the latest Gradle stable release download link; at the time of writing this, the stable release is gradle-2.14.1.
  3. Once the download is finished, go to the downloaded directory and extract the ZIP file into a convenient directory of your choice.
  4. Create an environment variable called GRADLE_HOME. Enter the extracted Gradle ZIP directory path as the value for the GRADLE_HOME environment variable.
  5. Finally, append the GRADLE_HOME variable to PATH by simply appending the text; %GRADLE_HOME%in to the PATH variable.

Now that you have installed Gradle on your Windows-based computer, to verify whether the installation was completed correctly, go to the command prompt, type gradle -v, and press Enter. The output shows the Gradle version and also the local environment configuration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.8.216