Install Gradle and check the version
Gradle is one program: a launcher script and a folder of jars. Nothing else is installed on the machine, no service runs in the background, and a project can carry its own copy of the tool. This lesson shows the installation this container has, reads gradle --version line by line, and explains the wrapper, which is how a real project pins its version.
What installing Gradle means
A distribution is a zip of about 130 MB. Unpacked, it holds a bin/ folder with the launcher, a lib/ folder with the jars, and the licence. Installing it means putting bin/gradle on the PATH, and nothing more:
which gradle
/opt/gradle/bin/gradle
ls /opt/gradle
LICENSE
NOTICE
README
bin
init.d
lib
The usual ways to get that folder on another machine are a package manager (brew install gradle, sdk install gradle), a package of the distribution such as apt install gradle, or the zip itself. All three download something, so none of them runs in this offline container; the installation is already there, at the path above.
gradle --version line by line
gradle --version
------------------------------------------------------------
Gradle 9.9.2
------------------------------------------------------------
Build time: 2026-11-19 19:52:07 UTC
Revision: 53873705aa44e5f145f335eefd2a254f2adff009
Kotlin: 2.4.21
Groovy: 4.0.33
Ant: Apache Ant(TM) version 1.10.17 compiled on April 6 2026
Launcher JVM: 21.0.13.1 (Alpine 21.0.13.1+2-alpine-r0)
Daemon JVM: /usr/lib/jvm/java-21-openjdk (no Daemon JVM specified, using current Java home)
The first block names the Gradle version and when it was built. The second names the language runtimes the build can use: Kotlin 2.4.21, which compiles the Kotlin DSL, and Groovy 4.0.33, which runs a Groovy build script. The Ant line is left from the tool Gradle grew out of, and the two JVM lines say which Java runs the launcher and which one runs the build itself. The OS line names the kernel of the machine, so it is left out here; yours will differ.
Note the Groovy version: it is the Groovy inside Gradle, not the one a groovy command prints. This image also has a standalone Groovy 5.0.8 at /opt/groovy, and the two do not have to agree; the Spock lesson shows where that matters.
The wrapper instead of an installation
A real project does not trust the Gradle on the PATH: two developers with 8.5 and 9.9 get two different builds. The project carries a wrapper instead, four small files that name one version and download it into the user’s home folder on the first run.
gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.2-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
The lesson The Gradle Wrapper writes these files with gradle wrapper and explains every line. For now one point matters: the file names a version (gradle-9.9.2-bin.zip) and a URL, and ./gradlew downloads exactly that distribution, so every machine that runs the project builds it with the same Gradle.
./gradlew --version
This command downloads the distribution named above on its first run, and this container has no network, so it is not run here. The next lesson writes the same four files with gradle init, which copies them from the installation and needs no network.
Related
- The Gradle Wrapper: the four files, the version they pin and the upgrade.
- The daemon and faster builds: what the Daemon JVM line of the version output means.
- Groovy: the language of the build scripts.
Article author: Arthur Isaev