Using OpenRewrite in Atoti FRTB

Overview

To help upgrade Atoti FRTB we have created a set of OpenRewrite recipes that can be used to automatically perform some of the migration steps.

See the Migration Notes page for the release for details on the recipes. For example, what recipes are available and what they do.

This page describes how to run the recipes.

Setting up

Start by updating your pom.xml so that you are using the com.activeviam.apps:frtb pom file for the new version. This will include the configuration of the OpenRewrite maven plugin in the openrewrite Maven profile.

Additionally, you will need the rewrite.yml file from the new release distribution in the root of your project.

The rewrite.yml file contains the recipes for the migration. These recipes can be run individually, or there is a single default recipe that will run all of them.

Using Maven to run the migration

The recipes can be run from maven using the rewrite-maven-plugin:run goal and the openrewrite profile:

mvn org.openrewrite.maven:rewrite-maven-plugin:run -P openrewrite -pl frtb-application

This will run the default recipe which is configured in the pom.xml file using the property rewrite.activeRecipes.

By changing the value of this property in the Maven command, individual recipes can be run. For example, to run the recipe com.activeviam.frtb.AddProperties_6_0 you can use:

mvn org.openrewrite.maven:rewrite-maven-plugin:run -P openrewrite -pl frtb-application -Drewrite.activeRecipes=com.activeviam.frtb.AddProperties_6_0

For further information on using the rewrite-maven-plugin, including the dryRun goal to just display the changes, see the OpenRewrite Maven plugin documentation.

Running the migration from your IDE

Modern IDEs can be used to execute the maven commands in the previous section.

The IntelliJ Ultimate IDE can run the OpenRewrite recipes directly. If you open the rewrite.yml file in IntelliJ Ultimate, beside each recipe you will see a green triangle (like a “play” button). This button can be used to run the recipe directly. See IntelliJ OpenRewrite documentation for more information.