OpenRewrite is an open-source automated refactoring ecosystem that applies recipes to source code. In the episode its recipes drive the migration of Java APIs during the upgrade.
OpenRewrite is an open-source ecosystem for automated source-code refactoring. Its stated goal is to help developers eliminate technical debt in their repositories by running prepackaged, open-source recipes for framework migrations, security fixes and stylistic consistency. The aim is to reduce work that would otherwise take hours or days to a matter of minutes. OpenRewrite was originally focused on Java, and the community is widening its language and framework coverage.
The central concept is the recipe. Recipes are the units that users run, and they are built from visitors, which make the actual modifications to the code. The OpenRewrite documentation gives one example: a visitor that turns assertTrue calls into static imports consistently across all test files. Because recipes are composed from such visitors, a larger migration can be expressed as a set of smaller, repeatable code changes that run in the same way every time.
Technically, OpenRewrite does not edit source files as plain text. It modifies Lossless Semantic Trees, which represent the source code, and then prints the changed trees back out as source. Because of this design, changes are minimally invasive and preserve the original formatting of the code. The practical result is a clean diff that a developer can review and commit like any other change. Recipes are run on one repository at a time through Gradle and Maven plugins. For running the recipe catalogue across many repositories, with mass commits and impact analysis, the documentation describes Moderne as a commercial platform. Moderne offers a free public service for open-source projects, and a multi-repo command-line interface is also available. The documentation further notes that recipes are moving from Maven Central to the Code Genome Project.
Typical situations for using OpenRewrite include upgrading the Java version of an application, moving from one framework version to another, and applying security fixes in bulk. In each case, the value lies in applying a known, reviewable transformation instead of hand-editing many files, with each modification visible in version control.
OpenRewrite appears in the M365.FM episode "Upgrade Java 8 Apps to Java 21 with AI Agents" (2025-11-28). In that episode, a co-pilot-style modernization agent takes over much of the repetitive work of moving a Java 8 application to Java 21 on Azure. According to the episode description, the agent inventories the entire stack, ranks CVEs by real reachability, auto-applies OpenRewrite recipes, aligns BOMs, fixes illegal reflective access and keeps every change traceable in Git. In this workflow, OpenRewrite recipes drive the migration of Java APIs during the upgrade, while the agent coordinates the surrounding steps. The same episode extends the scenario beyond the code upgrade to platform decisions such as Azure App Service versus Azure Spring Apps, migration to Azure SQL Database, Dockerfile generation, GitHub Actions CI/CD and secrets handling with Key Vault and managed identities.
The combination described in the episode reflects a common pattern: deterministic, recipe-based refactoring handles well-understood API migrations, while an AI agent handles inventory, prioritization and orchestration. Keeping the changes as reviewable diffs in Git is what makes the result auditable.
Overview compiled with AI from M365.FM episodes and the facts on this page. You can improve it with the edit button below.
Type
Product
Key points about OpenRewrite
Key points about OpenRewrite from the episodes, each with its source episode:
Stop burning cycles on manual Java upgrades. In this episode, we walk through a real-world, end-to-end modernization of a legacy Java 8 Spring app to Java 21, and show how AI agents quietly do the work your team keeps postponing—with receipts. You’ll hear how…
Frequently asked questions
Questions marked with AI were written with AI from the facts on this page.
What is OpenRewrite? (AI)
OpenRewrite is an open-source ecosystem for automated source-code refactoring. It runs recipes that perform framework migrations, security fixes and stylistic consistency changes, with the goal of eliminating technical debt.
How does OpenRewrite change code without disrupting formatting? (AI)
It modifies Lossless Semantic Trees that represent the source code and then prints the changed trees back as source. This keeps changes minimally invasive and preserves the original formatting, so the result can be reviewed as a diff.
What role does OpenRewrite play in the Java 8 to Java 21 episode? (AI)
In the episode "Upgrade Java 8 Apps to Java 21 with AI Agents", a modernization agent auto-applies OpenRewrite recipes, which drive the migration of Java APIs during the upgrade. Changes stay traceable in Git.
How can AI agents help upgrade Java 8 to Java 21?
A modernization agent inventories the whole stack, applies OpenRewrite recipes, aligns BOMs and fixes illegal reflective access. It handles the grind teams keep postponing and records each change. · From the episode: Upgrade Java 8 Apps to Java 21 with AI Agents
What is OpenRewrite used for here?
The agent auto-applies OpenRewrite recipes to automate code and dependency migrations. This replaces manual upgrade work with repeatable changes, and each change is kept auditable. · From the episode: Upgrade Java 8 Apps to Java 21 with AI Agents
Short info above, community knowledge below: add practical tips, examples or corrections. New contributions are reviewed first; trusted members publish directly.
Experts and companies for this topic
Nobody has listed this topic yet. Add it to your profile.