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).
Functions
Fully-qualified name of the OpenRewrite recipe to activate. Required — build throws IllegalStateException if not set.
Construct the RewriteRunner.
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.
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.
Set the number of parallel artifact download threads. Defaults to 5. When not set, falls back to downloadThreads from the tool config.
When true, the recipe is executed and results are returned but no files are written to disk. Defaults to false.
Skip parsing files with the given extensions. Overrides any excludeExtensions setting from the tool config file.
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.
Restrict parsing to the given file extensions (e.g. ".java", ".kt"). Overrides any includeExtensions setting from the tool config file.
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).
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.
The root directory of the project to analyse. Defaults to the current working directory. Must be an existing directory when RewriteRunner.run is called.
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.
Replace the full list of recipe artifact coordinates. Useful when coordinates are already collected into a List before building.
Replace the full list of extra Maven repositories for artifact resolution. Combined with any repositories declared in the tool config file.
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.
Path to a rewrite.yaml file for custom composite recipes.
Raw rewrite.yaml content. Takes precedence over rewriteConfig when both are set.