Skip to content

Skip redundant property override in child when parent declares same dependency#6955

Open
MBoegers wants to merge 2 commits intomainfrom
MBoegers/upgrade-dep-local-parent
Open

Skip redundant property override in child when parent declares same dependency#6955
MBoegers wants to merge 2 commits intomainfrom
MBoegers/upgrade-dep-local-parent

Conversation

@MBoegers
Copy link
Contributor

@MBoegers MBoegers commented Mar 12, 2026

Summary

  • When UpgradeDependencyVersion processes a managed dependency whose version is a property (e.g. ${flyway.version}), it now checks if a local parent POM also declares the same <dependency>. If so, the parent will be processed by the same recipe and will handle the property change — the child skips the redundant override.

  • Adds isDeclaredByLocalParent() helper that walks up the local parent chain checking for declared dependencies (not just managed ones), complementing the existing isManagedByLocalParent() method.

  • Fixes UpgradeDependencyVersion with overrideManagedVersion does not add property if <relativePath> is missing #6945

Test plan

  • UpgradeDependencyVersionTest.upgradeVersionDefinedViaImplicitPropertyInRemoteParentOfLocalParent_withoutRelativePath — parent and child both declare flyway-core, property only added to parent
  • Full UpgradeDependencyVersionTest suite passes (no regressions)
  • ChangePropertyValueTest and AddPropertyTest suites pass

…declares dependency

When UpgradeDependencyVersion processes a managed dependency whose
version is a property, and a local parent POM also declares the same
dependency, the parent will handle the property change. The child
should skip it to avoid a redundant property override.

Fixes #6945
@MBoegers MBoegers marked this pull request as ready for review March 12, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

UpgradeDependencyVersion with overrideManagedVersion does not add property if <relativePath> is missing

1 participant