Skip to content

Commit

Permalink
Add short explanation of multi-module maven + rewrite (#201)
Browse files Browse the repository at this point in the history
* Add short explanation of multi-module maven + rewrite

Fixes: #129

* Minor clarification based on Tim's suggestion

---------

Co-authored-by: Mike Sol <[email protected]>
  • Loading branch information
mike-solomon and mike-solomon authored Jul 11, 2023
1 parent 7f09d88 commit acc2bf8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [Running Rewrite on a Gradle project without modifying the build](running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build.md)
* [Running Rewrite on a Maven project without modifying the build](running-recipes/running-rewrite-on-a-maven-project-without-modifying-the-build.md)
* [Running Rewrite without build tool plugins](running-recipes/running-rewrite-without-build-tool-plugins.md)
* [Running Rewrite on a multi-module Maven project](/running-recipes/multi-module-maven.md)
* [Popular recipe guides](running-recipes/popular-recipe-guides/README.md)
* [Common static analysis issue remediation](running-recipes/popular-recipe-guides/common-static-analysis-issue-remediation.md)
* [Automatically fix Checkstyle violations](running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md)
Expand Down
30 changes: 30 additions & 0 deletions running-recipes/multi-module-maven.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Running OpenRewrite on a multi-module Maven project

If you have a Maven project with multiple modules, you may run into errors finding and running the [OpenRewrite Maven plugin](https://github.com/openrewrite/rewrite-maven-plugin).

There is currently an [open issue](https://github.com/openrewrite/rewrite-maven-plugin/issues/475) to better support multi-module Maven projects that you can +1 on if you'd like.

In the meantime, one way to work around this is to add a profile on the parent POM:

```xml
<profile>
<id>openrewrite</id>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.2.6</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.cleanup.Cleanup</recipe>
</activeRecipes>
<failOnDryRunResults>true</failOnDryRunResults>
</configuration>
</plugin>
</plugins>
</build>
</profile>
```

You can then run OpenRewrite from any submodule using this command: `mvn -Popenrewrite rewrite:run`.
1 change: 1 addition & 0 deletions running-recipes/running-recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* [Running Rewrite on a Gradle project without modifying the build](/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build.md)
* [Running Rewrite on a Maven project without modifying the build](/running-recipes/running-rewrite-on-a-maven-project-without-modifying-the-build.md)
* [Running Rewrite without build tool plugins](/running-recipes/running-rewrite-without-build-tool-plugins.md)
* [Running Rewrite on a multi-module Maven project](/running-recipes/multi-module-maven.md)
* [Popular recipe guides](/running-recipes/popular-recipe-guides/)
* [Common static analysis issue remediation](/running-recipes/popular-recipe-guides/common-static-analysis-issue-remediation.md)
* [Automatically fix Checkstyle violations](/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md)
Expand Down

0 comments on commit acc2bf8

Please sign in to comment.