← All recipes
Open source

Update Gradle wrapper

Recipe IDorg.openrewrite.gradle.UpdateGradleWrapper
Artifactorg.openrewrite:rewrite-gradle

Update the version of Gradle used in an existing Gradle wrapper. Queries downloads.gradle.org to determine the available releases, but prefers the artifact repository URL which already exists within the wrapper properties file. If your artifact repository does not contain the same Gradle distributions as downloads.gradle.org, then the recipe may suggest a version which is not available in your artifact repository.

Single recipeApache 2.0

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.gradle.UpdateGradleWrapper

If the recipe isn’t available locally, install it with:

mod config recipes jar install org.openrewrite:rewrite-gradle:8.88.0

Options

NameTypeDescription
versionStringAn exact version number or node-style semver selector used to select the version number. Defaults to the latest release available from downloads.gradle.org if not specified.
e.g. 7.x
distributionStringThe distribution of Gradle to use. "bin" includes Gradle binaries. "all" includes Gradle binaries, source code, and documentation. Defaults to the distribution type of the existing wrapper properties file, or "bin" if no wrapper properties file exists.
addIfMissingBooleanAdd a Gradle wrapper, if it's missing. Defaults to true.
wrapperUriStringThe URI of the Gradle wrapper distribution. Specifies a custom location from which to download the Gradle wrapper scripts (gradlew, gradlew.bat, etc.). This is useful for setting up the Gradle wrapper without relying on Gradle's official distribution services. When this option is set, the version and distribution fields must not be specified — only one source of truth is allowed. The URI should point to a valid and reachable Gradle wrapper distribution (typically a .zip archive containing the wrapper files). This is particularly helpful in environments where access to Gradle's central services is restricted or where custom Gradle wrapper setups are required. If the URI is inaccessible, the recipe will leave the existing wrapper files in the repository unchanged, as they are generally compatible with various Gradle versions.
e.g. https://downloads.gradle.org/distributions/gradle-8.5-bin.zip
distributionChecksumStringThe SHA-256 checksum of the Gradle distribution. If specified, the recipe will add the checksum along with the custom distribution URL.
e.g. 29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda

Data tables

Structured output this recipe can produce.

  • Source files that had resultsSource files that were modified by the recipe run.org.openrewrite.table.SourcesFileResults
  • Source files that had search resultsSearch results that were found during the recipe run.org.openrewrite.table.SearchResults
  • Source files that errored on a recipeThe details of all errors produced by a recipe run.org.openrewrite.table.SourcesFileErrors
  • Recipe performanceStatistics used in analyzing the performance of recipes.org.openrewrite.table.RecipeRunStats