Builder

Builder for RewriteRunner.

All setter methods return this for fluent chaining. The only required properties are projectDir and activeRecipe.

Defaults mirror the CLI defaults:

  • projectDir defaults to the current working directory.

  • dryRun defaults to false.

  • All list properties default to empty (meaning: use values from configFile if present, or built-in defaults).

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Fully-qualified name of the OpenRewrite recipe to activate. Required — build throws IllegalStateException if not set.

Link copied to clipboard

Construct the RewriteRunner.

Link copied to clipboard

Cache root for downloaded recipe JARs. Recipe artifacts are stored under <path>/repository, keeping them isolated from the user's Maven local repository. Project dependencies are always resolved from ~/.m2/repository regardless of this setting.

Link copied to clipboard

Path to the rewriterunner.yml tool config file for repository and cache configuration. If not set, auto-discovery checks <projectDir>/rewriterunner.yml first, then ~/.rewriterunner/rewriterunner.yml as a global fallback. File name matching is case-insensitive. If no file is found, built-in defaults apply.

Link copied to clipboard

Set the number of parallel artifact download threads. Defaults to 5. When not set, falls back to downloadThreads from the tool config.

Link copied to clipboard

When true, the recipe is executed and results are returned but no files are written to disk. Defaults to false.

Link copied to clipboard

Skip parsing files with the given extensions. Overrides any excludeExtensions setting from the tool config file.

Link copied to clipboard

Glob patterns (relative to the project root) for paths to skip during parsing. When non-empty, overrides parse.excludePaths from the tool config file. Supports the same glob syntax as java.nio.file.FileSystem.getPathMatcher.

Link copied to clipboard

Restrict parsing to the given file extensions (e.g. ".java", ".kt"). Overrides any includeExtensions setting from the tool config file.

Link copied to clipboard

Override whether Maven Central is included as a remote repository. When false, only the repositories explicitly configured via the tool config file are used. Useful in enterprise environments where Central is unreachable. When not set, falls back to includeMavenCentral from the tool config (default true).

Link copied to clipboard

Set the logger used for progress and diagnostic output. Defaults to NoOpRunnerLogger (silent). Use io.github.skhokhlov.rewriterunner.cli.LogbackRunnerLogger in the CLI, or provide a custom implementation for library use.

Link copied to clipboard

The root directory of the project to analyse. Defaults to the current working directory. Must be an existing directory when RewriteRunner.run is called.

Link copied to clipboard

Add a Maven coordinate (groupId:artifactId:version) whose JAR(s) will be downloaded and scanned for the requested recipe. May be called multiple times; all coordinates are accumulated. LATEST is accepted as the version token.

Link copied to clipboard

Replace the full list of recipe artifact coordinates. Useful when coordinates are already collected into a List before building.

Link copied to clipboard

Replace the full list of extra Maven repositories for artifact resolution. Combined with any repositories declared in the tool config file.

Link copied to clipboard

Add a single extra Maven repository for artifact resolution. May be called multiple times; all entries accumulate and are combined with any repositories declared in the tool config file.

Link copied to clipboard

Path to a rewrite.yaml file for custom composite recipes.

Link copied to clipboard

Raw rewrite.yaml content. Takes precedence over rewriteConfig when both are set.