OpenRewrite
Product
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 관련 에피소드에서는 Java, Azure App Service, Amazon Web Services (AWS), GitHub Actions 및 GitHub Copilot도 다룹니다.
Description
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 |
|---|
Community wiki
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.
Maintained by Mirko Peters (Microsoft MVP) · Last updated: