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

   ## Summary
   
   Fixes #12507. Supersedes #12515 (adds the missing test update that unblocks 
CI).
   
   `BaseParser.populateUserProperties()` interpolates user-specified `-D` 
values at CLI parse time against a callback that only knows 
`session.topDirectory` / `session.rootDirectory`. Every other expression — 
`${project.build.directory}`, `${user.dir}`, etc. — was silently replaced with 
`""` because the `Interpolator.interpolate(Map, UnaryOperator)` convenience 
overload defaults to `defaultsToEmpty=true`.
   
   This broke common CI patterns like 
`-DaltDeploymentRepository=id::file://${project.build.directory}/deploy` (URL 
becomes `file:///deploy` → wrong path, no error).
   
   ### Root cause
   
   PR #2480 added early interpolation of `-D` values to support 
`${session.topDirectory}`, but the `defaultsToEmpty=true` API default was not 
appropriate for this call site — it wiped all expressions the early callback 
couldn't resolve. Maven 3 left them literal for later evaluation at mojo 
configuration time.
   
   ### Changes
   
   - **`BaseParser.java`**: Pass `defaultsToEmpty=false` so unresolved 
placeholders stay literal for later evaluation by the plugin parameter 
expression evaluator. The `${session.topDirectory}` / 
`${session.rootDirectory}` support from #2480 is unaffected.
   - **`MavenITgh11978PlaceholderInCliArgTest`**: Update assertion to expect 
Maven 3 semantics — unknown `${...}` preserved as literal, not emptied. The 
emptying was an unintended side effect of #2480, not a deliberate behavior. The 
test's primary purpose (launcher doesn't crash on `${...}`) is unchanged.
   - **New IT `MavenITgh12507CliParamNestedInterpolationTest`**: Two cases 
(`${user.dir}` and `${project.build.directory}` in CLI-supplied plugin 
parameters) — red on current master, green with the fix.
   
   ### Credits
   
   Original fix and IT by @ascheman in #12515. This PR adds the 
`MavenITgh11978PlaceholderInCliArgTest` update and rebases onto current master 
to unblock CI.
   
   🤖 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