> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using openrewrite in Atoti FRTB

> Guide to running OpenRewrite recipes in Atoti FRTB to automate migration steps when upgrading to a new version

## Overview

To help upgrade Atoti FRTB, a set of OpenRewrite recipes is provided 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 the `pom.xml` so that it uses 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, the `rewrite.yml` file from the new release distribution is required in the root of the 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:

```syntaxhighlighter-pre theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
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`, use:

```syntaxhighlighter-pre theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
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](https://docs.openrewrite.org/reference/rewrite-maven-plugin).

## 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](https://www.jetbrains.com/help/idea/openrewrite.html#run-openrewrite-recipe) for more information.
