openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
254 stars 75 forks source link

javax.xml.ws convertion to jakarta.xml.ws isn't needed in this migration. #491

Closed aman-pebicloud closed 5 months ago

aman-pebicloud commented 8 months ago

What version of OpenRewrite are you using?

I am using

How are you running OpenRewrite?

I am using the maven plugin

Can you share your configuration so that we can rule out any configuration issues?

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>5.21.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.2.0</version>
                    </dependency>
                </dependencies>
            </plugin>

What did you expect to see?

I expected to see the complete migration to Spring 3.2 without manual intervention. However it didn't finish the migration properly. I noticed that after migration the compiler fails saying jakarta.xml.ws package not found.


 import jakarta.xml.ws.BindingProvider;
 import jakarta.xml.ws.Holder;

are not found and I had to manually convert them back to Java

 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Holder;

I also noted few more such conversions which were not needed and had to manually rollback to java, like contents of jakarta.ws.rs package jakarta.validation not found etc. Is this a known issue or I'm doing something incorrectly in the way I use the plugin.

timtebeek commented 8 months ago

Hi @aman-pebicloud ; thanks for reporting your issue here; It's a bit hard to say from just what you've provided if we should have added a dependency on jakarta.xml.ws-api or not have changed that package, as I do see a Jakarta BindingProvider as well. 🤔

We do call out to migrate from Javax to Jakarta from the Spring Boot 3.0 upgrade: https://github.com/openrewrite/rewrite-spring/blob/87734334164fa908ed1ce7ef5217bf059fb9491a/src/main/resources/META-INF/rewrite/spring-boot-30.yml#L56 That should add the dependency if using that package, unless it's available transitively https://github.com/openrewrite/rewrite-migrate-java/blob/bd4aa6286f558ed4a6d935add5e3f733dcaec2ba/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml#L817-L822

But it also looks like we first upgrade folks to Java 17, and through that to 11 https://github.com/openrewrite/rewrite-spring/blob/87734334164fa908ed1ce7ef5217bf059fb9491a/src/main/resources/META-INF/rewrite/spring-boot-30.yml#L31 That includes changing any explicit dependencies https://github.com/openrewrite/rewrite-migrate-java/blob/f1c66dfca985549cf5e37d4e261141842c9a69ef/src/main/resources/META-INF/rewrite/java-version-11.yml#L175-L181

Hard to say exactly what all goes in you ending up with a broken package. Would you be able to reproduce this in a small sample project on GitHub?

timtebeek commented 5 months ago

I'm going to close this one as not something we can reproduce given the information above, and knowing that we've revised these recipes thoroughly since. Thanks for reporting your issue though! Hope you're fully caught up by now.