openrewrite / rewrite-gradle-plugin

OpenRewrite's Gradle plugin.
Apache License 2.0
60 stars 37 forks source link

There were problems parsing some source files when running migrate to springboot 3 recipie #277

Closed Sanskarbajaj closed 7 months ago

Sanskarbajaj commented 7 months ago

There were problems parsing some source files, run with --info to see full stack traces There were problems parsing settings.gradle There were problems parsing x\y\z.gradle

is it ok to see these error messages ? but BUILD IS SUCCESSFUL

timtebeek commented 7 months ago

Those messages originate here. https://github.com/openrewrite/rewrite-gradle-plugin/blob/145a40e4fb0e71c1d6935b1c858c62e417e383e7/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java#L1135-L1143

The messages indicate there was a problem parsing those files, so we were unable to parse or manipulate those files. Have you tried running with --info to get additional details about those parse errors?

We'd be interested to see what trips up the parser in those files, such that we can fix the parser and start to make changes to those files if needed. How much details can you share?

Sanskarbajaj commented 7 months ago

java.lang.NoSuchMethodError: org.openrewrite.maven.search.FindDependency.(Ljava/lang/String;Ljava/lang/String;)V at org.openrewrite.java.spring.boot3.DowngradeServletApiWhenUsingJetty.getVisitor(DowngradeServletApiWhenUsingJetty.java:50) at org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$6(RecipeRunCycle.java:157) at org.openrewrite.scheduling.RecipeStack.reduce(RecipeStack.java:57) at org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$7(RecipeRunCycle.java:134)

this is what i get when tried with --info

shanman190 commented 7 months ago

So this initially appears as if you've got conflicting versions of the Spring and Maven modules on your classpath. What I usually do is to add a rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:<VERSION>")) to manage the dependency versions and alignment of all modules. From there, you would leave off the versions on any OpenRewrite library in the rewrite configuration and it'll ensure that everything is version aligned.

Also just so you know, there is an OpenRewrite slack workspace that you can join as well, if you want and can ask questions there in the #questions channel.

timtebeek commented 7 months ago

Indeed; perhaps our Slack is better suited to answer your questions.

You'll want to use rewrite-recipe-bom instruction for Gradle: https://github.com/openrewrite/rewrite-recipe-bom?tab=readme-ov-file#gradle-usage

And then use rewrite-recipe-bom v2.7.1, and the linked Gradle plugin version v6.8.4

timtebeek commented 7 months ago

Continued on Slack! :)