overrideManagedVersionShouldAddVersionToParentNotChild unit test #6442
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.
What's changed?
What's your motivation?
When calling
ChangeDependencyGroupIdAndArtifactIdwithoverrideManagedVersionset totrue, if you have:com.fasterxml.jackson:jackson-bom:2.20.0for example has a managed dependency ofcom.fasterxml.jackson.core:jackson-core:2.20.0)com.example:project:1.0.0) with the same managed dependency as the parent, but without a version number:com.example:child-project:1.0.0) with a direct dependency on the same dependency managed in the parent, specifically without aversiontag:and you're trying to change to a different
groupId(ex.some.group) ,artifactId(ex.some-artifact), andversion(ex.3.0.0), what ends up happening withChangeDependencyGroupIdAndArtifactIdis that the project'spom.xmlchanges to:and the module's
pom.xmlchanges to:Note worthy is that the requested version number appears on the module's
pom.xmldirect dependency, and not on the managed dependency despite this referring to a fully different artifact and group id and requesting it to update the managed version. If theversiontag was present on the manged dependency in project'spom.xmlto start with, the value will be updated, but no version number changes occur if the tag wasn't already existing, as above.Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
From the description: "A project (com.example:project:1.0.0) with the same managed dependency as the parent, but without a version number:". A dependency in a
<dependencyManagement>section will cause amvnbuild error. This leads me to wonder if there was some upstream recipe that changed a<dependencies>section to a<dependencyManagement>section, or if the version of the managed dependency was somehow removed. Still, it seems as though theChangeDependencyGroupIdAndArtifactIdrecipe should add the version to the managed dependency if the version is missing, or change it if the version is present.Checklist