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.