arconia rewrite run

The arconia rewrite run command runs OpenRewrite recipes to automatically update and refactor your codebase. It integrates with your build tool’s (Maven/Gradle) OpenRewrite plugin to execute the recipes.

Relationship to arconia update

The arconia update commands are curated shortcuts for the most common upgrades (Spring Boot, Spring AI, Arconia Framework, Gradle wrapper, Maven wrapper). Each one runs a specific, well-tested OpenRewrite recipe with sensible defaults.

The arconia rewrite run command gives you full control: you can run any OpenRewrite recipe, including recipes from the OpenRewrite OSS catalog, from the Arconia Migrations project, or from any other library.

Usage

Run a recipe from the OpenRewrite OSS core library:

arconia rewrite run --recipe-name org.openrewrite.java.RemoveUnusedImports

Preview changes without applying them:

arconia rewrite run \
    --recipe-name org.openrewrite.java.RemoveUnusedImports \
    --dry-run

Run a recipe from a specific library:

arconia rewrite run \
    --recipe-name io.arconia.rewrite.spring.ai.UpgradeSpringAi_1_0 \
    --recipe-library io.arconia.migrations:rewrite-spring

Run a recipe pinned to a specific library version:

arconia rewrite run \
    --recipe-name io.arconia.rewrite.spring.ai.UpgradeSpringAi_1_0 \
    --recipe-library io.arconia.migrations:rewrite-spring \
    --recipe-version 1.2.0

Pass extra parameters to the underlying build tool using --:

arconia rewrite run --recipe-name org.openrewrite.java.RemoveUnusedImports -- --stacktrace
arconia rewrite run --recipe-name org.openrewrite.java.RemoveUnusedImports -- -DmyProperty=value

Options

The following options are available:

Option Default Description

--dry-run

false

Preview the changes that would be made without modifying any files. Recommended before applying any recipe.

--recipe-name (required)

Fully qualified name of the OpenRewrite recipe to run. For example: io.arconia.rewrite.spring.ai.UpgradeSpringAi_1_0.

--recipe-library

Maven coordinates (groupId:artifactId) of the library containing the recipe. If not provided, the OpenRewrite OSS and Arconia recipe libraries will be used (see default recipe libraries). For example: io.arconia.migrations:rewrite-spring.

--recipe-version

Version of the recipe library to use. If not provided, the latest available version is resolved automatically. For example: 1.2.0.

--verbose or -v

false

Include verbose output.

--help or -h

Display help information for the command.

Build Tool Integration

The command automatically detects whether your project uses Maven or Gradle and runs the appropriate OpenRewrite task relying on the OpenRewrite Maven and Gradle plugins without modifying the build itself.

Use -- to pass parameters directly to the underlying build tool. The -- separator is required to distinguish Arconia CLI options from build tool parameters.