rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Process exclusion with `ChangeDependencyGroupIdAndArtifactId`

Open gliptak opened this issue 6 months ago • 9 comments

What's changed?

Process exclusion with ChangeDependencyGroupIdAndArtifactId

What's your motivation?

  • closes #2933

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • [x] I've added unit tests to cover both positive and negative cases
  • [x] I've read and applied the recipe conventions and best practices
  • [x] I've used the IntelliJ IDEA auto-formatter on affected files

gliptak avatar Jul 11 '25 23:07 gliptak

Thanks a lot for taking this on! Looks good already but I'll have a closer look when I'm back end of next week. One thing we try to avoid is adding new options to recipes of a default works good enough, as combinations of options make it harder to reason and maintain, and require updates to constructors. Not sure exactly here, but curious to hear your thoughts.

timtebeek avatar Jul 12 '25 07:07 timtebeek

thank you @timtebeek

while this introduces a new flag, I landed here as a backward compatible approach

from https://github.com/openrewrite/rewrite/issues/2933#issue-1613140091 I would look to transform old to new for all reference types at once, so I most align with Proposal B ("incremental" break and targeting a deprecation)

gliptak avatar Jul 12 '25 13:07 gliptak

I'm not sure github-actions[bot] PR reviews compile

gliptak avatar Jul 28 '25 13:07 gliptak

Thanks yes the Google bot sometimes gets confused; the underlying patch file better illustrates the changes it wants to see:

diff --git a/rewrite-maven/src/test/java/org/openrewrite/maven/ChangeDependencyGroupIdAndArtifactIdTest.java b/rewrite-maven/src/test/java/org/openrewrite/maven/ChangeDependencyGroupIdAndArtifactIdTest.java
index 997051f..6420ef2 100644
--- a/rewrite-maven/src/test/java/org/openrewrite/maven/ChangeDependencyGroupIdAndArtifactIdTest.java
+++ b/rewrite-maven/src/test/java/org/openrewrite/maven/ChangeDependencyGroupIdAndArtifactIdTest.java
@@ -1677,19 +1677,19 @@ void changeDependencyGroupIdAndArtifactIdWithVersionProperty() {
         );
     }
 
-    @Test
     @Issue("https://github.com/openrewrite/rewrite/issues/2933")
+    @Test
     void changeExclusionsEnabled() {
         rewriteRun(
                 spec -> spec.recipe(new ChangeDependencyGroupIdAndArtifactId(
-                        "org.springframework", 
-                        "spring-web", 
-                        "org.springframework.boot", 
-                        "spring-boot-starter-web", 
-                        null, 
-                        null, 
-                        null, 
-                        null, 
+                        "org.springframework",
+                        "spring-web",
+                        "org.springframework.boot",
+                        "spring-boot-starter-web",
+                        null,
+                        null,
+                        null,
+                        null,
                         true)), // changeExclusions = true
                 pomXml(
                         """
@@ -1748,19 +1748,19 @@ void changeExclusionsEnabled() {
         );
     }
 
-    @Test
     @Issue("https://github.com/openrewrite/rewrite/issues/2933")
+    @Test
     void changeExclusionsDisabled() {
         rewriteRun(
                 spec -> spec.recipe(new ChangeDependencyGroupIdAndArtifactId(
-                        "org.springframework", 
-                        "spring-web", 
-                        "org.springframework.boot", 
-                        "spring-boot-starter-web", 
-                        null, 
-                        null, 
-                        null, 
-                        null, 
+                        "org.springframework",
+                        "spring-web",
+                        "org.springframework.boot",
+                        "spring-boot-starter-web",
+                        null,
+                        null,
+                        null,
+                        null,
                         false)), // changeExclusions = false
                 pomXml(
                         """

timtebeek avatar Jul 28 '25 13:07 timtebeek

thank you @timtebeek updated

gliptak avatar Jul 29 '25 02:07 gliptak

@timtebeek please approve workflow runs

gliptak avatar Aug 07 '25 19:08 gliptak

@timtebeek am I to resolve conflicts here?

gliptak avatar Aug 13 '25 14:08 gliptak

my (narrow) usecase was about package name change, where exclusions have to be processed to complete transformation

please guide on how you might see more complex/transitive usecases covered (maybe as a followup PR)

gliptak avatar Sep 02 '25 16:09 gliptak

@timtebeek please guide on next steps

gliptak avatar Sep 30 '25 20:09 gliptak