You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/07/23 16:06:26 UTC
(maven) 02/03: Fix #12507: dont wipe unresolved ${...} in -D values
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch bugfix/cli-param-nested-interpolation
in repository https://gitbox.apache.org/repos/asf/maven.git
commit 3191d76815d492fe404f786723300f2b437e0099
Author: Gerd Aschemann <as...@apache.org>
AuthorDate: Tue Jul 21 09:23:19 2026 +0200
Fix #12507: dont wipe unresolved ${...} in -D values
BaseParser.populateUserProperties interpolated user-specified
properties with defaultsToEmpty=true against a paths-only callback,
silently replacing every expression it could not resolve (system
properties, project.* references) with the empty string. Pass
defaultsToEmpty=false so unresolved placeholders stay literal and are
evaluated later with full session/project context by the plugin
parameter expression evaluator -- restoring Maven 3 semantics for
values like -DaltDeploymentRepository=id::file://${project.build.directory}/x.
Co-Authored-By: Claude Fable 5 <no...@anthropic.com>
---
.../src/main/java/org/apache/maven/cling/invoker/BaseParser.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/BaseParser.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/BaseParser.java
index bd8a6e6693..9a740753bb 100644
--- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/BaseParser.java
+++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/BaseParser.java
@@ -438,7 +438,11 @@ protected Map<String, String> populateUserProperties(LocalContext context) {
Map<String, String> userSpecifiedProperties = context.options != null
? new HashMap<>(context.options.userProperties().orElse(new HashMap<>()))
: new HashMap<>();
- createInterpolator().interpolate(userSpecifiedProperties, paths::get);
+ // Resolve only early-available path placeholders (session.topDirectory & co); leave everything
+ // else literal so it can be evaluated later with full session/project context by the
+ // plugin parameter expression evaluator (gh-12507: wiping unresolved ${...} to the empty
+ // string silently broke e.g. -DaltDeploymentRepository=id::file://${project.build.directory}/x).
+ createInterpolator().interpolate(userSpecifiedProperties, paths::get, false);
// ----------------------------------------------------------------------
// Load config files