gradle-wrapper
TLDR
Generate wrapper with the current Gradle version
Generate wrapper with a specific Gradle version
Generate wrapper with a specific distribution type
Generate wrapper using a specific distribution URL
SYNOPSIS
gradle wrapper [options] [--gradle-version <version>] [--distribution-type all|bin] [--gradle-distribution-url <url>]
PARAMETERS
--gradle-version <version>
Gradle version to download and use (e.g., 8.5)
--distribution-type <type>
bin for binary-only or all for full distribution with docs/sources
--gradle-distribution-url <url>
Custom URL for Gradle distribution ZIP
--gradle-argument <args>
Arguments passed to downloaded Gradle
DESCRIPTION
The gradle wrapper command (often referred to in contexts as gradle-wrapper functionality) is a Gradle task that automatically generates the necessary files to bootstrap a Gradle distribution for a specific project. This enables team members, CI servers, and other users to build the project without requiring a local Gradle installation.
Running gradle wrapper creates three key files: gradlew (Unix/Linux shell script), gradlew.bat (Windows batch file), and the gradle/wrapper directory containing gradle-wrapper.jar and gradle-wrapper.properties. The wrapper script downloads the specified Gradle version from the official repository on first run, caches it locally, and executes the build.
This ensures consistent builds across environments, avoiding 'works on my machine' issues due to version mismatches. It's a standard practice in Gradle projects, committed to version control. After generation, builds are invoked via ./gradlew <task> instead of gradle <task>. The command requires an existing Gradle installation to run initially.
CAVEATS
Requires pre-installed Gradle to generate wrapper. Wrapper download needs internet on first use. Custom URLs must point to valid ZIP archives.
POST-GENERATION USAGE
Invoke builds with ./gradlew build or ./gradlew tasks. Wrapper is self-updating via ./gradlew wrapper.
FILE LOCATIONS
gradlew at project root; gradle/wrapper/gradle-wrapper.properties holds version/URL config.
HISTORY
Introduced in Gradle 0.9 (2009), became standard in 1.0 (2012). Evolved to support custom distributions and better caching in modern versions.
SEE ALSO
gradle(1)


