Gradle is a build automation tool written in and for java, but can be used to build lots of software types.
Check Your Java Installation
Gradle requires a JDK, ideally Java8 onwards. So lets check the version of Java you have installed at the windows command line.
java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
I have a Java11 JDK, so will be fine to install Gradle. Ensure you have at least Java8 installed.
Download Gradle
Go the the Gradle release page and download the latest version. Click on the binary-only to download the gradle zip file.
Unzip Gradle
Extract the zip file (Click show in folder from browser, then right click to extract all). Create a folder called gradle on your C:\ drive and copy the folder extracted from your gradle zip into here.
Add Gradle To Your Environment Variables
In the windows 10 search bar, type “Environment Variables” and then click on the link that comes up.
The System Properties screen should appear. When it does click on the “Environment Variables” button shown at the bottom.
This should show the environment variables screen. Under system variables at the bottom click the new button to add a new environment variable.
Type in GRADLE_HOME and the Variable Name and the path to your gradle installation as the variable value. Mine is in C:\Gradle\gradle-7.4
Click ok to add the new System Variable.
Then under System Variables, scroll until you find the Path variable. Select it and the click edit.
When you get the Edit Environment Variable screen, click new to add an entry to the path.
Add the path to your gradle bin folder, and then click ok.
Click ok on the remaining dialogs to save the changes.
Verify Gradle Installation Added To Your Environment
At the windows command line, run the follow to verify Gradle is setup correctly.
gradle –v
Welcome to Gradle 7.4!
Here are the highlights of this release:
- Aggregated test and JaCoCo reports
- Marking additional test source directories as tests in IntelliJ
- Support for Adoptium JDKs in Java toolchains
For more details see https://docs.gradle.org/7.4/release-notes.html
------------------------------------------------------------
Gradle 7.4
------------------------------------------------------------
Build time: 2022-02-08 09:58:38 UTC
Revision: f0d9291c04b90b59445041eaa75b2ee744162586
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.11 (AdoptOpenJDK 11.0.11+9)
OS: Windows 10 10.0 amd64
And we are done.