Skip to content

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

Merged
merged 1 commit into from
Jun 23, 2025
Merged

Cleanup: ChangeParentPom recipe #5656

merged 1 commit into from
Jun 23, 2025

Conversation

jevanlingen
Copy link
Contributor

What's changed?

Nothing, just refactoring.

Checklist

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

@jevanlingen jevanlingen self-assigned this Jun 23, 2025
@jevanlingen jevanlingen added the recipe Requested Recipe label Jun 23, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jun 23, 2025
@@ -1653,53 +1711,6 @@ void shouldNotAddToDependencyManagement() {
));
}

@Test
void doesNotAddMavenDefaultProperties() {
Copy link
Contributor Author

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> {
Copy link
Contributor Author

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());
Copy link
Contributor Author

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:

public @Nullable String getValue(@Nullable String value) {
if (value == null) {
return null;
}
return placeholderHelper.replacePlaceholders(value, this::getProperty);
}

@jevanlingen jevanlingen changed the title Cleanup ChangeParentPom Cleanup: ChangeParentPom recipe Jun 23, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Jun 23, 2025
@jevanlingen jevanlingen merged commit 335425c into main Jun 23, 2025
2 checks passed
@jevanlingen jevanlingen deleted the refactor-ChangeParentPom branch June 23, 2025 11:08
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Requested Recipe
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants