rewrite:run

Full name:

org.openrewrite.maven:rewrite-maven-plugin:6.57.0:run

Description:

Run the configured recipes and apply the changes locally.

This variant of rewrite:run will fork the maven life cycle and can be run as a "stand-alone" goal. It will execute the maven build up to the process-test-classes phase.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: process-test-classes.
  • Invokes the execution of the following lifecycle phase prior to executing itself: process-test-classes.

Optional Parameters

Name Type Since Description
<activeRecipes> LinkedHashSet<String> - The recipes to run, by the name they are given in their specs.openrewrite.org/v1beta/recipe resource. No recipe runs unless it is listed here.
User Property: rewrite.activeRecipes
<activeStyles> LinkedHashSet<String> - The styles to apply, by the name they are given in their specs.openrewrite.org/v1beta/style resource. No style is applied unless it is listed here.
User Property: rewrite.activeStyles
<additionalPlainTextMasks> LinkedHashSet<String> - Files to parse as plain text in addition to the default masks, as glob patterns like those of exclusions. For example, **/*.ext.
User Property: rewrite.additionalPlainTextMasks
<checkstyleConfigFile> String - A Checkstyle configuration file to derive the coding style from, instead of detecting it from the Checkstyle plugin.
User Property: rewrite.checkstyleConfigFile
Alias: checkstyleConfigFile
<checkstyleDetectionEnabled> boolean - Whether to derive the coding style from the configuration of the Checkstyle plugin, when the build uses it.
Default: true
User Property: rewrite.checkstyleDetectionEnabled
Alias: checkstyleDetectionEnabled
<configLocation> String - The OpenRewrite YAML configuration file, as a path or an http(s) URL. A relative path is resolved against the directory of each module, so prefixing it with ${maven.multiModuleProjectDirectory} has every module use the same file at the root of the repository.
Default: ${maven.multiModuleProjectDirectory}/rewrite.yml
User Property: rewrite.configLocation
Alias: configLocation
<exclusions> LinkedHashSet<String> - Paths not to parse, as PathMatcher glob patterns relative to the root of the repository, where ** matches any number of directories and * a single directory or file name. For example, docs/**.
User Property: rewrite.exclusions
<exportDatatables> boolean - Whether to export the data tables that recipes produce as CSV files, to target/rewrite/datatables.
Default: false
User Property: rewrite.exportDatatables
<failOnInvalidActiveRecipes> boolean - Whether to fail the build when an active recipe, or a recipe it includes, is not configured correctly. This may default to true in the future.
Default: false
User Property: rewrite.failOnInvalidActiveRecipes
Alias: failOnInvalidActiveRecipes
<options> LinkedHashSet<String> - Options to configure the active recipe with, as key=value pairs. Only a single recipe that does not include other recipes can be configured this way. For example, -Drewrite.options=methodPattern=java.util.List add(..),key2=value2.
User Property: rewrite.options
<plainTextMasks> LinkedHashSet<String> - The files to parse as plain text, as glob patterns like those of exclusions, replacing the default masks. The defaults cover common text files without a dedicated parser, such as Markdown, shell scripts and Dockerfiles. Exclusions take precedence over plain text masks, and additionalPlainTextMasks has no effect when this is set.
User Property: rewrite.plainTextMasks
<pomCacheDirectory> String - The directory to create the .rewrite-cache directory with cached POMs and Maven metadata in. Defaults to the user's home directory. Deleting the cache is safe, as it is populated again on the next run.
User Property: rewrite.pomCacheDirectory
Alias: pomCacheDirectory
<pomCacheEnabled> boolean - Whether to cache downloaded POMs and Maven metadata on disk, in pomCacheDirectory. When disabled, an in-memory cache is used instead, which makes runs slower on projects with deep dependency trees.
Default: true
User Property: rewrite.pomCacheEnabled
Alias: pomCacheEnabled
<recipeArtifactCoordinates> LinkedHashSet<String> - Recipe artifacts to add, as groupId:artifactId:version coordinates, instead of or in addition to plugin dependencies. These are resolved from the repositories of the project rather than its plugin repositories.
User Property: rewrite.recipeArtifactCoordinates
<recipeChangeLogLevel> LogLevel - The level to log the changes that recipes make at: ERROR, WARN, INFO or DEBUG.
Default: WARN
User Property: rewrite.recipeChangeLogLevel
<resolvePropertiesInYaml> boolean - Whether to resolve Maven properties, like ${project.artifactId}, in the YAML configuration file.
Default: true
User Property: rewrite.resolvePropertiesInYaml
<rewriteSkip> boolean - Whether to skip the execution of the plugin, to disable it without removing its configuration.
Default: false
User Property: rewrite.skip
<runPerSubmodule> boolean - Whether to run recipes on each module separately, rather than once on all the modules of the build.
Default: false
User Property: rewrite.runPerSubmodule
Alias: runPerSubmodule
<sizeThresholdMb> int - The size in megabytes above which files other than Java sources are not parsed.
Default: 10
User Property: sizeThresholdMb
<skipMavenParsing> boolean - Whether to skip parsing pom.xml files, and the POMs they inherit from, as source files. This can make runs faster when no recipe changes POMs.
Default: false
User Property: skipMavenParsing

Parameter Details

<activeRecipes>

The recipes to run, by the name they are given in their specs.openrewrite.org/v1beta/recipe resource. No recipe runs unless it is listed here.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.activeRecipes

<activeStyles>

The styles to apply, by the name they are given in their specs.openrewrite.org/v1beta/style resource. No style is applied unless it is listed here.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.activeStyles

<additionalPlainTextMasks>

Files to parse as plain text in addition to the default masks, as glob patterns like those of exclusions. For example, **/*.ext.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.additionalPlainTextMasks

<checkstyleConfigFile>

A Checkstyle configuration file to derive the coding style from, instead of detecting it from the Checkstyle plugin.
  • Type: java.lang.String
  • Required: No
  • User Property: rewrite.checkstyleConfigFile
  • Alias: checkstyleConfigFile

<checkstyleDetectionEnabled>

Whether to derive the coding style from the configuration of the Checkstyle plugin, when the build uses it.
  • Type: boolean
  • Required: No
  • User Property: rewrite.checkstyleDetectionEnabled
  • Default: true
  • Alias: checkstyleDetectionEnabled

<configLocation>

The OpenRewrite YAML configuration file, as a path or an http(s) URL. A relative path is resolved against the directory of each module, so prefixing it with ${maven.multiModuleProjectDirectory} has every module use the same file at the root of the repository.
  • Type: java.lang.String
  • Required: No
  • User Property: rewrite.configLocation
  • Default: ${maven.multiModuleProjectDirectory}/rewrite.yml
  • Alias: configLocation

<exclusions>

Paths not to parse, as PathMatcher glob patterns relative to the root of the repository, where ** matches any number of directories and * a single directory or file name. For example, docs/**.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.exclusions

<exportDatatables>

Whether to export the data tables that recipes produce as CSV files, to target/rewrite/datatables.
  • Type: boolean
  • Required: No
  • User Property: rewrite.exportDatatables
  • Default: false

<failOnInvalidActiveRecipes>

Whether to fail the build when an active recipe, or a recipe it includes, is not configured correctly. This may default to true in the future.
  • Type: boolean
  • Required: No
  • User Property: rewrite.failOnInvalidActiveRecipes
  • Default: false
  • Alias: failOnInvalidActiveRecipes

<options>

Options to configure the active recipe with, as key=value pairs. Only a single recipe that does not include other recipes can be configured this way. For example, -Drewrite.options=methodPattern=java.util.List add(..),key2=value2.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.options

<plainTextMasks>

The files to parse as plain text, as glob patterns like those of exclusions, replacing the default masks. The defaults cover common text files without a dedicated parser, such as Markdown, shell scripts and Dockerfiles. Exclusions take precedence over plain text masks, and additionalPlainTextMasks has no effect when this is set.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.plainTextMasks

<pomCacheDirectory>

The directory to create the .rewrite-cache directory with cached POMs and Maven metadata in. Defaults to the user's home directory. Deleting the cache is safe, as it is populated again on the next run.
  • Type: java.lang.String
  • Required: No
  • User Property: rewrite.pomCacheDirectory
  • Alias: pomCacheDirectory

<pomCacheEnabled>

Whether to cache downloaded POMs and Maven metadata on disk, in pomCacheDirectory. When disabled, an in-memory cache is used instead, which makes runs slower on projects with deep dependency trees.
  • Type: boolean
  • Required: No
  • User Property: rewrite.pomCacheEnabled
  • Default: true
  • Alias: pomCacheEnabled

<recipeArtifactCoordinates>

Recipe artifacts to add, as groupId:artifactId:version coordinates, instead of or in addition to plugin dependencies. These are resolved from the repositories of the project rather than its plugin repositories.
  • Type: java.util.LinkedHashSet<java.lang.String>
  • Required: No
  • User Property: rewrite.recipeArtifactCoordinates

<recipeChangeLogLevel>

The level to log the changes that recipes make at: ERROR, WARN, INFO or DEBUG.
  • Type: org.openrewrite.maven.LogLevel
  • Required: No
  • User Property: rewrite.recipeChangeLogLevel
  • Default: WARN

<resolvePropertiesInYaml>

Whether to resolve Maven properties, like ${project.artifactId}, in the YAML configuration file.
  • Type: boolean
  • Required: No
  • User Property: rewrite.resolvePropertiesInYaml
  • Default: true

<rewriteSkip>

Whether to skip the execution of the plugin, to disable it without removing its configuration.
  • Type: boolean
  • Required: No
  • User Property: rewrite.skip
  • Default: false

<runPerSubmodule>

Whether to run recipes on each module separately, rather than once on all the modules of the build.
  • Type: boolean
  • Required: No
  • User Property: rewrite.runPerSubmodule
  • Default: false
  • Alias: runPerSubmodule

<sizeThresholdMb>

The size in megabytes above which files other than Java sources are not parsed.
  • Type: int
  • Required: No
  • User Property: sizeThresholdMb
  • Default: 10

<skipMavenParsing>

Whether to skip parsing pom.xml files, and the POMs they inherit from, as source files. This can make runs faster when no recipe changes POMs.
  • Type: boolean
  • Required: No
  • User Property: skipMavenParsing
  • Default: false