Search code examples
openrewrite

UpgradeSpringBoot_3_2 recipe not found in rewrite-spring jar file


I have a task to upgrade our project to Spring Boot 3.x. And I chose OpenRewrite tool to help me with this task. However, I'm facing the issue where UpgradeSpringBoot_3_2 recipe can't be found in rewrite-spring jar file

I downloaded the rewrite-spring:5.11.0 jar using Maven with below code snippet.

 <dependency>
   <groupId>org.openrewrite.recipe</groupId>
   <artifactId>rewrite-spring</artifactId>
   <version>5.11.0</version>
 </dependency>

...

<plugin>
  <groupId>org.openrewrite.maven</groupId>
  <artifactId>rewrite-maven-plugin</artifactId>
  <version>5.32.0</version>
</plugin>

Then I checked the jar file if the below recipe exist using it's full path but it's not there org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2

Is there anything I missed here? I can see there are recipes inside boot3 folder but what I was looking for was not there. I added screenshot of my Intellij IDE encircling the boot3 folder and UpgradeSpringBoot_3_2 can't be found inside it

enter image description here

Other things I tried is I checked other versions of rewrite-spring by downloading them and checking what's inside boot3 folder and didn't find any UpgradeSpringBoot_3_x recipe

Below is my reference https://docs.openrewrite.org/recipes/java/spring/boot3/upgradespringboot_3_2


Solution

  • Follow the documentation, you didn't.

    The dependency should be part of your plugin configuration not a regular dependency.

    <plugin>
      <groupId>org.openrewrite.maven</groupId>
      <artifactId>rewrite-maven-plugin</artifactId>
      <version>5.32.0</version>
      <configuration>
          
        <activeRecipes>
          <recipe>org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2</recipe>
        </activeRecipes>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.openrewrite.recipe</groupId>
          <artifactId>rewrite-spring</artifactId>
          <version>5.11.0</version>
        </dependency>
      </dependencies>
    </plugin>
    
    

    For some reason you decided to move the dependency as a regular dependency and as such thus aren't following the way it is documented. (Hence not following the documentation).