-
Hi, I am trying to write a recipe that pending code version will run one declarative yml recipe from a code recipe. I already have all recipes in declarative mode. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @raizer76 ! It sounds like you might want to do a staged upgrade of your projects; first going from v2 to v3, then from v3 to v4, etc. Would that be the correct way to phrase things? You might be interested in how we approach that for rewrite-spring, where we have declarative recipes for each version, which chain in the previous version as the first recipe to run. See for instance this upgrade to Spring Boot 3.1: type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1
displayName: Migrate to Spring Boot 3.1
description: 'Upgrade to Spring Boot 3.1'
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_0
- org.openrewrite.java.spring.boot3.MavenPomUpgrade_3_1
- org.openrewrite.java.spring.boot3.SpringBootProperties_3_1 That includes as a first step the upgrade to Spring Boot 3.0, which itself includes the 2.7 upgrade, all the way down to Spring Boot 1.5. As a user you can then choose to execute any of those recipes, be it 2.7, 3.0 or 3.1, and OpenRewrite will figure out where you are and (only) pull you up to that specific version. That way there's less of a concern in conditionally executing steps from the recipe, but rather when you invoke a recipe you can choose which steps you want applied. Could the above approach be an option for your use case as well? |
Beta Was this translation helpful? Give feedback.
Hi @raizer76 ! It sounds like you might want to do a staged upgrade of your projects; first going from v2 to v3, then from v3 to v4, etc. Would that be the correct way to phrase things?
You might be interested in how we approach that for rewrite-spring, where we have declarative recipes for each version, which chain in the previous version as the first recipe to run. See for instance this upgrade to Spring Boot 3.1: