-
Notifications
You must be signed in to change notification settings - Fork 434
Cleanup: ChangeParentPom recipe #5656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1653,53 +1711,6 @@ void shouldNotAddToDependencyManagement() { | |||
)); | |||
} | |||
|
|||
@Test | |||
void doesNotAddMavenDefaultProperties() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 This test contained the same code as the doesNotAddGlobalProperties
test.
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
private static class UnconditionalAddProperty extends MavenIsoVisitor<ExecutionContext> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Contained nearly the same code as the AddPropertyVisitor.
} | ||
return resolvedGroupId.equals(dep.getGroupId()) && resolvedArtifactId.equals(dep.getArtifactId()); | ||
.noneMatch(it -> { | ||
String groupId = resolvedPom.getValue(it.getGroupId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 The getValue
does already take properties into account:
rewrite/rewrite-maven/src/main/java/org/openrewrite/maven/tree/ResolvedPom.java
Lines 284 to 289 in 5d38687
public @Nullable String getValue(@Nullable String value) { | |
if (value == null) { | |
return null; | |
} | |
return placeholderHelper.replacePlaceholders(value, this::getProperty); | |
} |
What's changed?
Nothing, just refactoring.
Checklist