Saturday, February 7, 2015

Gradle for Beginners

Gradle

  • Gradle is an automation tool that supports the concepts of Apache Maven and Apache Ant.
  • It introduces the Groovy based domain specific language to describe the project configuration rather than xml as in Apache Maven
Installation of Apache Gradle
  • Download the zip from https://gradle.org/get-started
  • Set the GRADLE_HOME variable 
           
  • Now make an entry for the Gradle in the Path Environment Setting


  • Ensure gradle has installed correctly by running the command gradle -v

Setting up a Sample Java Project using Gradle

  • Move to the appropriate directory where we need to set up the project.
  • Now run the command gradle init --type java-library

  • We would get the following Project Structure where build.gradle is the configuration file

Gradle  Wrapper Structure

    Hope you could notice gradle directory inside created project structure and within which we could find a properties file and a wrapper jar within.

    We also have a gradlew file right in the root Project Path and this would invoke the gradle properties file and download Gradle version mentioned within it at the appropriate directory.

   Hence to compile or build a gradle project, we don't have to install Gradle in our system,
just running gradlew at Project Root would install Gradle.



 and gradlew build  at Project Root would build the project indeed.




   This solves the work of the build engineer while migratng from already existng build system to Gradle where he doesn't have to insist developers on how to install Gradle rather Gradlew command would take care of that.


No comments:

Post a Comment