Skip to content

Gradle

Gradle is a build management tool capable of bundling the project and effectively handle dependency management.

Official Documentation

Installation

In a lot of cases you may not need to install gradle globally. Instead your project may have a local gradle copy, that can be accessed in some cases by $ ./gradlew -v

Best way to install would be through sdkman. Alternatively use brew.

# Option 1
$ sdk install gradle

# Option 2
$ brew install gradle

Verify

# Display gradle version for global installation
$ gradle -v

# Display gradle version for local installation
$ ./gradlew -v

# List tasks
$ ./gradlew tasks

Manage Process / Tasks

# Stop all running gradle processes
$ ./gradlew --stop

Gradle Wrapper

If existing Gradle-based build uses the Gradle Wrapper, you can easily upgrade by running the wrapper task, specifying the desired Gradle version:

$ ./gradlew wrapper --gradle-version=8.0 --distribution-type=bin

Note that it is not necessary for Gradle to be installed to use the Gradle wrapper. The next invocation of gradlew or gradlew.bat will download and cache the specified version of Gradle.


Last update: April 16, 2024