This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch maven-deploy-plugin-4.x in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
commit fdfb1111aa97817b4a7dcef29c1e99b22023647b Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Sat Nov 21 20:41:20 2026 +0100 Resolve compound version expressions from pom.properties A version such as 1.0-${changelist} is as undeployable as ${revision}, and pom.properties records the whole resolved value, so the check is for any property reference, not only a value that is one. --- .../java/org/apache/maven/plugins/deploy/DeployFileMojo.java | 9 +++++---- .../org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java index 8b4f76a..cccba58 100644 --- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java +++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java @@ -605,9 +605,10 @@ public class DeployFileMojo extends AbstractDeployMojo { } /** - * Completes coordinates that remain unresolved after processing the embedded POM. Only pure property references - * are supported; compound expressions such as {@code 1.0-${changelist}} are intentionally left unchanged. The - * replacement values are read from the adjacent {@code pom.properties} file. + * Completes coordinates that remain unresolved after processing the embedded POM. A coordinate that still + * contains a property reference, such as {@code ${revision}} or {@code 1.0-${changelist}}, is replaced as a + * whole by the value recorded in the adjacent {@code pom.properties} file. Coordinates without a property + * reference are never overwritten. * * @param properties the properties read from the adjacent {@code pom.properties} file */ @@ -626,7 +627,7 @@ public class DeployFileMojo extends AbstractDeployMojo { } private static boolean isUnresolvedProperty(String value) { - return value != null && value.startsWith("${") && value.endsWith("}"); + return value != null && value.contains("${"); } /** diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java index 7095158..45547c5 100644 --- a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java +++ b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java @@ -172,14 +172,14 @@ class DeployFileMojoUnitTest { } @Test - void processPomPropertiesLeavesCompoundExpressionsUnchanged() { + void processPomPropertiesResolvesCompoundExpressions() { mojo.setVersion("1.0-${changelist}"); Properties properties = new Properties(); - properties.setProperty("version", "2.0.0"); + properties.setProperty("version", "1.0-SNAPSHOT"); mojo.processPomProperties(properties); - assertEquals("1.0-${changelist}", mojo.getVersion()); + assertEquals("1.0-SNAPSHOT", mojo.getVersion()); } private void checkMojoProperties(
