ascheman opened a new pull request, #12515:
URL: https://github.com/apache/maven/pull/12515

   Fixes #12507.
   
   ## Root cause
   
   `BaseParser.populateUserProperties()` interpolates user-specified `-D` 
values at CLI parse time via the `Interpolator` convenience overload, which 
defaults to `defaultsToEmpty=true`, against a callback that only knows the 
`extraInterpolationSource()` paths (`session.topDirectory` / 
`session.rootDirectory`). Every other expression — system properties like 
`${user.dir}`, project references like `${project.build.directory}` — was 
silently replaced with the empty string before any session/project context 
existed.
   
   Maven 3 resolves such expressions at mojo configuration time; the v3-compat 
`PluginParameterExpressionEvaluator` in Maven 4 would too, but it only ever saw 
the already-wiped value.
   
   This is independent of the recent launcher quoting fixes (#11978 / #11983): 
those fixed the shell layer so `${...}` arguments reach the JVM intact. On rc-5 
the launcher bug masked this issue with a loud `bad substitution` shell error; 
with the launcher fix shipping in rc-6, users hit this silent 
empty-substitution instead.
   
   ## Fix
   
   Pass `defaultsToEmpty=false` for the user-specified properties: placeholders 
that cannot be resolved from the early paths map stay literal and are evaluated 
later with full session/project context. The `${session.topDirectory}` / 
`${session.rootDirectory}` support from #2480 is unaffected.
   
   ## Testing
   
   - New IT `MavenITgh12507CliParamNestedInterpolationTest` (two cases: 
`${user.dir}` and `${project.build.directory}` in a CLI-supplied plugin 
parameter): red against the current master distro (`expected: <PRE-…-POST> but 
was: <PRE--POST>`), green with the fix.
   - All 33 `maven-cli` test suites pass.
   - End-to-end: `mvn deploy 
'-DaltDeploymentRepository=test::file://${project.build.directory}/deploy'` 
deploys to `target/deploy/…` again (was: `file:///deploy` → `Read-only file 
system`).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to