Skip to content
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

Handle bom import in RemoveDuplicateDependencies #4504

Conversation

DidierLoiseau
Copy link
Contributor

What's changed?

Added support for <scope>import</scope> in RemoveDuplicateDependencies

What's your motivation?

It seems we have duplicate imports in our poms 😏

Have you considered any alternatives or workarounds?

I don’t really see any.

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

@@ -125,6 +125,9 @@ private boolean isManagedDependenciesTag() {
}

private @Nullable DependencyKey getManagedDependencyKey(Xml.Tag tag) {
if (tag.getChildValue("scope").map("import"::equalsIgnoreCase).orElse(false)) {
return DependencyKey.from(tag);
}
ResolvedManagedDependency resolvedDependency = findManagedDependency(tag);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findManagedDependency() does not actually find imported boms. It seems they are not included in dependency management by the resolver.

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for yet another improvement @DidierLoiseau ; Must say I really appreciate your thorough work! :)

@timtebeek timtebeek added bug Something isn't working enhancement New feature or request labels Sep 20, 2024
@timtebeek timtebeek merged commit 3dc8dde into openrewrite:main Sep 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants