← All recipes
Moderne licensed

Add -parameters compiler flag for Spring in Gradle

Recipe IDorg.openrewrite.gradle.spring.AddParametersCompilerFlagToGradleArtifactorg.openrewrite.recipe:rewrite-spring

Adds options.compilerArgs.add("-parameters") to JavaCompile tasks and, when the Kotlin Gradle Plugin version can be determined from this file's plugins {} block, the matching javaParameters flag (compilerOptions.javaParameters on 1.8+, kotlinOptions.javaParameters on older versions) to Kotlin compile tasks. Spring uses parameter name retention for dependency injection. Projects using the Spring Boot Gradle plugin already have both flags configured and are not modified. When the Kotlin plugin's version can't be determined from this file (version catalogs, convention plugins, buildscript classpath declarations) the Kotlin flag is left alone rather than risk emitting a form the applied plugin doesn't support.

Single recipeMSAL

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.spring.AddParametersCompilerFlagToGradle

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

mod config recipes jar install org.openrewrite.recipe:rewrite-spring:RELEASE

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