Spring Rewrite Commons provides abstractions and parsers for OpenRewrite.
OpenRewrite is a code refactoring, remediation, and modernization automation tool providing a rich catalog of recipes for task like automated code transformations.
These are the main components offered by Spring Rewrite Commons:
-
RewritePlugin
- Helper to execute OpenRewrite’s Gradle or Maven plugin through Java -
RewriteProjectParser
- Parse a project to an OpenRewrite LST outside a build tool plugin. -
ProjectResourceSet
- Encapsulates the LST to run OpenRewrite recipes sequentially. -
RewriteRecipeDiscovery
- Discover recipes on the classpath. -
ProjectResourceSetSerializer
- Serialize the current state of theProjectResourceSet
to the filesystem. -
Some helpers for testíng also exist
Then the dependency can be retrieved.
Some working examples exist to demo what can be built using Spring Rewrite Commons.
-
Atomically upgrade a Spring Boot application
-
Iteratively upgrade a Spring Boot application using PRs
-
Find applicable recipes by doing a dry-run
All examples can be found here.