Skip to main content

Intro

Today, we're going to apply migration engineering with OpenRewrite.

This workshop consists of several sections, each focusing on a different aspect of improving your code.

#SectionTimeLevel
1Analyze first - Find what you're currently using, and how that would need to change.~30 minBeginner
2Outdated patterns - Common legacy testing frameworks and libraries that are still in use today.~45 minBeginner
3JUnit Jupiter - Migrate to JUnit 5 (Jupiter), learn about JUnit 6, and explore features like parameterized and nested tests.~45 minBeginner - Intermediate
4Adopt AssertJ - Dive into AssertJ for more expressive assertions.~60 minIntermediate
5Upgrade your projects - Apply what we've learned to upgrade real-world projects.~75 minIntermediate
6Secure your projects - Scan for vulnerable dependencies and remediate common OWASP findings.~30 minBeginner - Intermediate
7Recipe development - Create custom OpenRewrite recipes to automate improvements in your own codebases.~60 minAdvanced (optional)
tip

Short on time? Sections 1-4 form a self-contained "quick wins" track (~3 hours) that covers the most impactful improvements. Sections 5-7 go deeper and can be tackled later.

When you're done, see Further resources for links to keep learning.

Getting Started

Clone the repository

To get started, clone the workshop repository:

git clone https://github.com/openrewrite/migration-engineering-with-openrewrite.git
cd migration-engineering-with-openrewrite

This repository contains example code that you'll use throughout the workshop to explore the topics, write tests, and practice refactoring techniques.

The repository has three top-level directories you should know about:

  • books/ - Example projects that the recipes get applied to. You'll see before/after transformations here.
  • recipes/ - Refaster templates and tests you'll complete in the Recipe development section.
  • site/ - This documentation site. You generally won't edit anything here.

Workshop structure

We recommend going through the sections in order, but you're welcome to go at your own pace.

You're also welcome to use your own projects to try out the improvements alongside the provided examples.

What you'll need

To run recipes (sections 1-6):

  • Java 8+
  • Moderne CLI (recommended), or
  • Maven 3+, or
  • Gradle 4.10+

To develop your own recipes (the Recipe development section only):

  • Java 25