2

Hopefully somebody can help me :)

I am trying to update a project from spring boot 2.5 to spring boot 2.7 with the openrewrite recipe. After trying this several times I keep getting the same error message.

I tried excluding the exact module this error happens, but it will just skip that and give the same error on the next module (I have 3 modules in total) Also tried removing the .m2 folder but still the same error.

The following is my pom rewrite:

<plugin>
                    <groupId>org.openrewrite.maven</groupId>
                    <artifactId>rewrite-maven-plugin</artifactId>
                    <version>5.2.4</version>
                    <configuration>
                        <activeRecipes>
                            <recipe>org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_7</recipe>
                        </activeRecipes>
                        <exclusions>
                            <exclude>*/node/**</exclude>
                            <exclude>*/node_modules/**</exclude>
                            <exclude>*/target/**</exclude>
                        </exclusions>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.openrewrite.recipe</groupId>
                            <artifactId>rewrite-spring</artifactId>
                            <version>5.0.1</version>
                        </dependency>
                    </dependencies>
                </plugin>

After mvn rewrite:run the error message is:

[ERROR] The recipe produced an error. Please report this to the recipe author.

[ERROR] Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:5.2.4:run (default-cli) on project my-project: Execution default-cli of goal org.openrewrite.maven:rewrite-maven-plugin:5.2.4:run failed: Error while visiting my-module/src/main/java/nl/commons/util/someClass.java: java.lang.NoSuchMethodError: 'boolean org.openrewrite.java.MethodMatcher.matches(org.openrewrite.java.tree.J$MethodInvocation)'
[ERROR]   org.openrewrite.java.testing.mockito.PowerMockitoMockStaticToMockito$PowerMockitoToMockitoVisitor.visitMethodInvocation(PowerMockitoMockStaticToMockito.java:164)
[ERROR]   org.openrewrite.java.testing.mockito.PowerMockitoMockStaticToMockito$PowerMockitoToMockitoVisitor.visitMethodInvocation(PowerMockitoMockStaticToMockito.java:48)
[ERROR]   org.openrewrite.java.tree.J$MethodInvocation.acceptJava(J.java:3706)
[ERROR]   org.openrewrite.java.tree.J.accept(J.java:59)
[ERROR]   org.openrewrite.TreeVisitor.visit(TreeVisitor.java:278)
[ERROR]   org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:361)
[ERROR]   org.openrewrite.java.JavaVisitor.visitRightPadded(JavaVisitor.java:1284)
[ERROR]   org.openrewrite.java.JavaVisitor.lambda$visitBlock$4(JavaVisitor.java:367)

Thanks in advance!

Niek

Niek7301
  • 21
  • 1
  • Could you try again with rewrite-spring 5.0.2 released yesterday? https://github.com/openrewrite/rewrite-spring/releases/tag/v5.0.2 – Tim Jun 27 '23 at 15:55
  • There was unfortunately an inadvertent change that made it in, which has since been reverted. We're flushing out all the cases where it's causing issues; and doing patch releases where necessary. Rewrite-spring already has such a patch release. – Tim Jun 27 '23 at 15:57
  • 1
    That works perfectly. Thanks! Ps. I am upgrading after seeing your JFall talk on the subject so thanks for the inspiration as well ;) – Niek7301 Jun 27 '23 at 16:18
  • Glad to hear that works, and that I could help you twice! :) – Tim Jun 28 '23 at 17:22

0 Answers0