← All recipes
Open source

Add Gradle property

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

Add a property to the gradle.properties file.

Single recipeApache 2.0

Usage

You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.gradle.AddProperty --recipe-option "key=org.gradle.caching" --recipe-option "value=true" --recipe-option "overwrite=true"

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

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

Options

NameTypeDescription
keyrequiredStringThe name of the property to add.
e.g. org.gradle.caching
valuerequiredStringThe value of the property to add.
e.g. true
overwriterequiredBooleanIf a property with the same key exists, overwrite.
e.g. true
filePatternStringA glob expression that can be used to constrain which directories or source files should be searched. When not set, all source files are searched.
e.g. **/*.properties

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