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 |
|---|---|---|
|
|
Preview the changes that would be made without modifying any files. Recommended before applying any recipe. |
|
Fully-qualified name of the OpenRewrite recipe to run. For example: |
|
|
Maven coordinates ( |
|
|
Version of the recipe library to use. If not provided, the latest available version is resolved automatically. For example: |
|
|
|
Include verbose output. |
|
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.