arconia rewrite

The arconia rewrite 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 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 --recipe-name org.openrewrite.java.RemoveUnusedImports

Preview changes without applying them:

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

Run a recipe from a specific library:

arconia rewrite \
    --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 \
    --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 --recipe-name org.openrewrite.java.RemoveUnusedImports -- --stacktrace
arconia rewrite --recipe-name org.openrewrite.java.RemoveUnusedImports -- -DmyProperty=value
Commit your project to version control before running this command so you can review the changes and revert if needed.

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 core library is used. 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.

Recipe Discovery

To discover available recipes, visit the OpenRewrite Recipe Catalog. Use the --dry-run option to preview changes before applying them.

The OpenRewrite Recipe Catalog includes recipes with different licenses. Some are open-source (Apache 2.0); others use the Moderne Source Available License or Moderne Proprietary License. Review the license of any recipe before running it. See OpenRewrite module versions for details.

You can find additional recipes in the Arconia Migrations project. All Arconia recipes are open-source, released under the Apache 2.0 license.