Micronaut framework 4.0 release incorporates auto-upgrade with OpenRewrite recipes

Tim te Beek
|
August 3, 2023
Micronaut framework 4 auto-upgrade with OpenRewrite

Key Takeaways

Three weeks ago the Micronaut team released version 4.0.0 of the Micronaut framework. As we join them in celebration, we also want to express our gratitude for the collaboration leading up to their release. With Jeremy Grelle from the Micronaut team in the lead, we at Moderne helped develop and deliver OpenRewrite migration recipes for users of the Micronaut framework. This allows users to migrate automatically on the day of the release, bringing them up to date quickly despite breaking changes.

In an earlier in-depth webinar, Raquel Pau from Moderne joined Sergio del Amo and Jeremy from the Micronaut team to discuss OpenRewrite and the Micronaut framework 4 automated upgrade. Raquel shared an overview of OpenRewrite and its technology, and Jeremy provided a detailed update of a Micronaut application using automation from OpenRewrite. 

Jeremy noted that with any major release you’ll typically find breaking changes, and that’s the case with the latest Micronaut framework major update. For example, they have migrated fully from JavaX to Jakarta packages in Micronaut framework 4. This means that you would have to go through every class and change the imports to the modern versions. With OpenRewrite, you can change all these instances automatically.

With documentation available for users of Gradle and Maven, it’s easy to upgrade. And since the Micronaut framework migration recipes build upon existing OpenRewrite migration recipes, users are automatically upgraded to Java 17 and Jakarta in a matter of minutes.

Jeremy had this to say about working with OpenRewrite:

“We're really pleased to have been able to closely collaborate with the OpenRewrite developers at Moderne such that we were able to provide an automated Micronaut framework 3-to-4 upgrade recipe to the community from day 1 of our new release. Micronaut framework 4 is a major upgrade with significant performance improvements and quite a bit of modernization made possible by the adoption of a Java 17 baseline. We want to make it as painless as possible for our users to gain these benefits, and the OpenRewrite recipes have greatly helped to achieve that as evidenced by the positive feedback we've received from users who have already had success in upgrading their applications.”

After a successful migration we invite users to explore further recipes. For instance, you can resolve static analysis findings or adopt AssertJ best practices, all available through the same mechanism of safe automated code changes. And with a thousand plus recipes to choose from, there’s bound to be something worthwhile to improve or secure your codebase.

Automating code changes allows library and framework authors to bring users along to newer versions, despite required changes. This allows them to focus their efforts on the latest version, and getting users onto that version, rather than having to maintain multiple versions through backports over time.

At OpenRewrite we invite anyone to contribute recipes for a variety of use cases, whether that’s migrations, security, or code style issues. If you want to get involved feel free to drop by our public Slack channel or open a GitHub issue. This invitation is open to regular users or maintainers alike, with documentation available to help you get started with recipe development.

Once recipes are available, these can run locally through OpenRewrite build plugins for Maven and Gradle. You can also run these recipes at scale through the Moderne platform in a matter of minutes. This allows you to run any OpenRewrite recipe against some 25,000+ Open Source repositories to affect changes across an entire organization or ecosystem.

The Moderne platform is available for free to Open Source projects, with private options available for organizations both big and small. Contact Moderne for more information.

Colorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzle

Back to Blog

Colorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzle

Back to Engineering Blog