Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/reference/rewrite-maven-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The OpenRewrite Maven plugin offers these goals:
* `mvn rewrite:dryRunNoFork` - Generate warnings to the console for any recipe that would make changes and generates a diff file in each Maven module's `target` folder. This variant does not fork the Maven life cycle and can be a more efficient choice when using Rewrite within a CI workflow when combined with other Maven goals.
* `mvn rewrite:discover` - Generate a report of available recipes found on the classpath.
* `mvn rewrite:typetable` - [Generate a type table](/authoring-recipes/multiple-versions#typetable-generation-for-maven-projects) to support multiple versions of a single library.
* `mvn rewrite:recipeCsvGenerate` - Generate a `recipes.csv` marketplace file from the recipes found in this project.

:::info
_`rewrite`_ name-spaced properties can be used for substituting plugin properties:
Expand Down Expand Up @@ -142,6 +143,18 @@ To find out what recipes a rewrite module provides, see its documentation and th

Execute `mvn rewrite:typetable` to [generate a type table](/authoring-recipes/multiple-versions#typetable-generation-for-maven-projects) to support multiple versions of a single library.

## The "recipeCsvGenerate" goal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor - but it is a bit weird to me that this section comes before the type table section when it comes after the typetable in the previous section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! moved the section


Execute `mvn rewrite:recipeCsvGenerate` to generate a `recipes.csv` [marketplace](https://docs.moderne.io/user-documentation/moderne-cli/references/recipes-csv/) file from the recipes found in this project. This is the Maven equivalent of the Gradle `recipeCsvGenerate` task provided by the [OpenRewrite Gradle build plugin](https://github.com/openrewrite/rewrite-build-gradle-plugin).

The goal scans compiled classes and resources in `target/classes/` for recipe definitions (both Java class-based and YAML declarative recipes) and writes the result to `src/main/resources/META-INF/rewrite/recipes.csv`. If an existing `recipes.csv` is present, generated data is merged into it, preserving any manually added entries such as custom category assignments.

The goal automatically forks the Maven lifecycle to `process-classes`, so classes and resources will be compiled before scanning.

:::info
For more details on the CSV format and how it is used by the Moderne CLI, see the [Moderne docs on the CSV recipe marketplace](https://docs.moderne.io/user-documentation/moderne-cli/references/recipes-csv).
:::

## The "Run" goal

Execute `mvn rewrite:run` to run the active recipes and apply the changes. This will write changes locally to your source files on disk. Afterward, review the changes, and when you are comfortable with the changes, commit them. The `run` goal generates warnings in the build log wherever it makes changes to source files.
Expand Down