Update a BOM version property declared locally but imported by a parent - #8876
Merged
Merged
Conversation
Jammy-Louie
force-pushed
the
upgrade-dependency-version-bom-property
branch
from
September 14, 2026 15:02
847c60b to
5e16c76
Compare
Jammy-Louie
marked this pull request as ready for review
September 14, 2026 15:13
|
|
Member
|
That's a good point @kdelay ! |
…ut don't have the exact same set of published versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A pom can declare the version property that an ancestor uses to import a BOM.
UpgradeDependencyVersionnever updated that property, so the module silently stays on the old version.The shape, using the published
spring-cloud-starter-parent:2025.0.0as an example:Maven resolves the inherited
dependencyManagementagainst the child's effective properties, so the child's value is the one that picks the release train. Overriding it this way is the documented approach for Spring Cloud and Spring Boot.What broke
The scanner only begins looking for a property once it sees a tag containing
${...}, and from there searches upward through parent poms. That covers a child referencing${x}that a parent declares. The reverse never starts: the reference lives in the ancestor, which is not a source file, so no tag in the repository contains${...}at all. The dependencies are versionless because the BOM manages them, and the property is a bare number in<properties>with nothing tying it to the BOM.Three outcomes today:
overrideManagedVersion: an explicit<version>is pinned onto the dependency and the property is still left behind.The editing visitor does not save it either. Its property branch is gated on
dm.getRequestedBom() == null, so BOM-managed dependencies never reach it.The fix
The scanner now also reads each pom's resolved dependency management, which retains the raw expression from whichever pom declared the import:
When the imported BOM's own coordinates match the recipe's globs and its requested version is a property, the newer BOM version is recorded against whichever source pom declares that property: the pom being visited, or the nearest parent still in the sources via the existing
storeParentPomProperty. Matching on the BOM's own coordinates keeps this scoped, so upgrading a single dependency that a BOM happens to manage does not move the BOM's version property.Tests
UpgradeDependencyVersionTest.ImportedBomVersionPropertycovers the remote parent import, a child overriding a property its in-source parent declares (both poms must reach the new version),overrideManagedVersionchanging the property rather than pinning a version onto the dependency, and the negative case where the BOM's coordinates do not match and the property must be left alone. The first three fail before this change.