Process exclusion with `ChangeDependencyGroupIdAndArtifactId`
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
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.
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)
I'm not sure github-actions[bot] PR reviews compile
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(
"""
thank you @timtebeek updated
@timtebeek please approve workflow runs
@timtebeek am I to resolve conflicts here?
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)
@timtebeek please guide on next steps