[#12303] Fix CI-friendly ${revision} not interpolated for non-build POM reads#12322
Open
gnodet wants to merge 1 commit into
Open
[#12303] Fix CI-friendly ${revision} not interpolated for non-build POM reads#12322gnodet wants to merge 1 commit into
gnodet wants to merge 1 commit into
Conversation
c846987 to
882e183
Compare
…dency POMs
In DefaultModelBuilder.doReadFileModel(), the CI-friendly version
interpolation for non-build requests (dependency/parent POM reads)
was guarded by `else if (modelSource.getPath() != null)`.
Since ResolvedPathSource.getPath() always returns null for
repository-resolved POMs, the ${revision} replacement never executed.
Changed to unconditional else so getEnhancedProperties() and
replaceCiFriendlyVersion() always run for non-build requests.
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.
Summary
Fixes the
${revision}CI-friendly version placeholder not being interpolated when Maven reads dependency or parent POMs outside of a build request (e.g. when themaven-remote-resources-pluginresolves the project's own POM).DefaultModelBuilder.doReadFileModel(), the CI-friendly version interpolation for non-build requests was guarded byelse if (modelSource.getPath() != null). SinceResolvedPathSource.getPath()always returnsnull, thereplaceCiFriendlyVersion()call was dead code.elseblock sogetEnhancedProperties()andreplaceCiFriendlyVersion()always run for non-build requests.${revision}in its version.Verified against the original use case (bigtop-manager project from #12303): without the fix,
process-resourcesfails withInvalid Version Range Request: ...pom:${revision}; with the fix, the version resolves correctly to1.2.0-SNAPSHOT.Fixes #12303
Test plan
MavenITgh12303CIFriendlyRevisionRemoteResourcesTestpassesClaude Code on behalf of Guillaume Nodet