You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/06/19 05:07:21 UTC
[PR] [#12303] Fix CI-friendly ${revision} not interpolated for dependency POMs [maven]
gnodet opened a new pull request, #12322:
URL: https://github.com/apache/maven/pull/12322
## Summary
- Fix dead-code bug in `DefaultModelBuilder.doReadFileModel()` where 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`, the `${revision}` replacement never executed.
- Changed to `else { if (modelSource.getPath() != null) { ... } }` so the `getEnhancedProperties()` and `replaceCiFriendlyVersion()` calls always run for non-build requests.
- Updated IT to exercise the fix with a pre-installed dependency (`ci-lib`) whose parent POM uses `${revision}` in its version.
Fixes #12303
## Test plan
- [ ] IT `MavenITgh12303CIFriendlyRevisionRemoteResourcesTest` passes (resolves `ci-lib-parent:${revision}` → `ci-lib-parent:1.0`)
- [ ] Existing CI-friendly version tests still pass
- [ ] No regressions in model builder behavior for build requests
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12303] Fix CI-friendly ${revision} not interpolated for non-build POM reads [maven]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #12322:
URL: https://github.com/apache/maven/pull/12322#discussion_r3470439731
##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java:
##########
@@ -1692,6 +1692,30 @@ Model doReadFileModel(Set<Path> activeModelReads) throws ModelBuilderException {
model = model.withProperties(newProps);
}
model = model.withProfiles(merge(model.getProfiles(), userProps));
+ } else {
+ if (modelSource.getPath() != null) {
+ model = model.withPomFile(modelSource.getPath());
+ }
+ if (rootDirectory != null) {
+ try {
+ Map<String, String> properties =
+ getEnhancedProperties(model, rootDirectory, activeModelReads);
+ model = model.with()
+ .version(replaceCiFriendlyVersion(properties, model.getVersion()))
+ .parent(
+ model.getParent() != null
+ ? model.getParent()
+ .withVersion(replaceCiFriendlyVersion(
+ properties,
+ model.getParent()
+ .getVersion()))
+ : null)
+ .build();
+ } catch (ModelBuilderException e) {
+ logger.debug("Could not read root model properties for CI-friendly"
+ + " version interpolation: " + e.getMessage());
+ }
Review Comment:
The catch block logs only `e.getMessage()` and drops the exception itself, which makes debugging harder (no stack trace) while still swallowing the failure. Pass the exception as the second argument to `logger.debug(...)` so the stack trace is available when needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12303] Fix CI-friendly ${revision} not interpolated for non-build POM reads [maven]
Posted by "Bukama (via GitHub)" <gi...@apache.org>.
Bukama commented on PR #12322:
URL: https://github.com/apache/maven/pull/12322#issuecomment-4795887698
> Run 'mvn spotless:apply' to fix these violations.
:)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12303] Fix CI-friendly ${revision} not interpolated for non-build POM reads [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #12322:
URL: https://github.com/apache/maven/pull/12322
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org