rewrite-maven-plugin icon indicating copy to clipboard operation
rewrite-maven-plugin copied to clipboard

Recipe org.openrewrite.maven.UpgradeParentVersion doesn't work since 6.0.2 plugin version

Open heruv1m opened this issue 10 months ago • 3 comments

What version of OpenRewrite are you using?

I am using 6.0.2 maven plugin version

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

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

What is the smallest, simplest way to reproduce the problem?

recipeList:
  - org.openrewrite.maven.UpgradeParentVersion:
      groupId: my.group.id
      artifactId: my-artifact-id
      newVersion: 3.0.0

What did you expect to see?

    <parent>
        <groupId>my.group.id</groupId>
        <artifactId>my-artifact-id</artifactId>
        <version>3.0.0</version>
    </parent>

What did you see instead?

    <parent>
        <groupId>my.group.id</groupId>
        <artifactId>my-artifact-id</artifactId>
        <version>2.0.0</version>
    </parent>

What is the full stack trace of any errors you encountered?

Recipe make no changes

Are you interested in contributing a fix to OpenRewrite?

heruv1m avatar May 29 '25 10:05 heruv1m

Hi! Sorry to hear that's not working for you; did you try the latest versions? because 6.0.2 is quite old by now.

The recipe itself mostly delegates to another recipe: https://github.com/openrewrite/rewrite/blob/9ad4471b3e5d98863a16291aa853885a46d34dfb/rewrite-maven/src/main/java/org/openrewrite/maven/UpgradeParentVersion.java#L85-L93

Perhaps it helps to run with mvnDebug and attach a debugger with a breakpoint set in https://github.com/openrewrite/rewrite/blob/main/rewrite-maven/src/main/java/org/openrewrite/maven/ChangeParentPom.java

Other than that it's hard to say what's going on for you with the information provided.

timtebeek avatar May 29 '25 10:05 timtebeek

Actually I found it on latest version 6.10.0 and then found that last robust version is 6.0.1. You can reproduce it with latest bom version with unit tests too

heruv1m avatar May 29 '25 11:05 heruv1m

Do note that we validate the arguments passed into the recipe before applying; perhaps that's what's failing in your case? That's what makes it so I can not attempt to replicate, as I know those values do not exist.

timtebeek avatar May 29 '25 11:05 timtebeek