skip to content

In gradle-wrapper.properties, what does distributionUrl control, and what is the practical difference between the '-bin' and '-all' distribution variants?

level: juniorimportance: must knowfreq 70%

answer

  1. version is parsed from the URL filename
  2. -bin = runtime only
  3. -all = + sources & docs for IDE
  4. wrapper ignores system Gradle
  5. set via wrapper --distribution-type

basics

~10 s

distributionUrl tells the wrapper which Gradle version to download. The '-bin' zip contains only the runtime; '-all' also bundles sources and documentation so IDEs can show Gradle API docs. Both run builds identically.

solid answer

~40 s

`distributionUrl` is the single most important wrapper key: it pins the exact Gradle distribution the wrapper downloads and uses, e.g. `https://services.gradle.org/distributions/gradle-8.7-bin.zip`. The version embedded in this URL is the authoritative version of Gradle for the project — `./gradlew` ignores any locally installed Gradle. The `-bin` variant ships only the binaries needed to run builds and is the default/recommended for CI and most projects because it is smaller and faster to download. The `-all` variant additionally bundles the Gradle **source code and documentation**, which lets IDEs (IntelliJ) provide richer API completion and Javadoc for Gradle DSL. Functionally builds behave identically with either. You normally change this URL via `./gradlew wrapper --gradle-version 8.7 --distribution-type all` rather than editing by hand.

code

properties · 6 lines
properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
networkTimeout=10000

go deeper

for a junior

Know that distributionUrl pins the Gradle version and -bin is the lean default; -all just adds docs.

for a middle

Explain that the version is parsed from the URL filename, the wrapper ignores system Gradle, and you change it with the wrapper task and --distribution-type.

for a senior

Discuss caching by URL key under GRADLE_USER_HOME and why teams standardize on -bin for CI and possibly -all for dev ergonomics.

for a principal

Frame distributionUrl as the org-wide version pin for reproducible builds; consider mirroring distributions internally and governing upgrades across many repos.

## What `distributionUrl` is The Gradle Wrapper is a small script (`gradlew`/`gradlew.bat`) plus a tiny jar that downloads and runs a **specific** Gradle version, so everyone on the team and CI uses the same one without installing Gradle globally. The configuration lives in `gradle/wrapper/gradle-wrapper.properties`. The key that selects the version is `distributionUrl`: ```properties distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip ``` The version number is parsed **out of the file name** in this URL. When you run `./gradlew build`, the wrapper: 1. Reads `distributionUrl`. 2. Computes a cache key from the URL and checks `~/.gradle/wrapper/dists/`. 3. If absent, downloads and unpacks the zip there, then executes that Gradle. Because the version is encoded in the URL, the wrapper completely **ignores** any system-installed `gradle` on the PATH — that is the whole point of reproducibility. ## `-bin` vs `-all` The download name ends in either `-bin.zip` or `-all.zip`: - **`-bin`** — only the binaries (jars, scripts) required to *run* builds. Smaller, faster to download/cache. Recommended default, especially on CI where docs are useless. - **`-all`** — everything in `-bin` **plus the Gradle sources and offline HTML/Javadoc documentation**. The only practical benefit is that IDEs can index the Gradle API to give better autocompletion and inline documentation when writing build scripts. It does not change build behaviour or available features. ## Changing it correctly Prefer the `wrapper` task over hand-editing, because it also refreshes the wrapper jar/scripts consistently: ```bash ./gradlew wrapper --gradle-version 8.7 --distribution-type all ``` `--distribution-type` accepts `bin` (default) or `all`. The version segment of `distributionUrl` is what Gradle treats as the source of truth — keep it accurate.

  • If a teammate has Gradle 9 installed system-wide but the wrapper says 8.7, which version runs ./gradlew build?
    8.7. The wrapper downloads and runs exactly the version in distributionUrl and ignores any Gradle on the PATH.
  • Is there any runtime/behavioural difference between building with -bin vs -all?
    No. Builds behave identically. -all only adds sources/docs for IDE assistance and increases download size.

saying these in an interview costs you the question

  • Claiming -all enables extra Gradle features or plugins (it doesn't).
  • Saying the wrapper uses the system-installed Gradle version.
  • Hand-editing only distributionUrl and assuming the wrapper jar/scripts also updated.

context