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 244672359d0a263593b243fd6b371978d3d00b66
Author: Efe Gökdemir <[email protected]>
AuthorDate: Fri Sep 25 21:04:05 2026 +0300

    #649: resolve CI-friendly versions from pom properties
    
    Signed-off-by: Efe Gökdemir <[email protected]>
---
 .../maven/plugins/deploy/DeployFileMojo.java       | 26 ++++++++++++++++++++++
 .../plugins/deploy/DeployFileMojoUnitTest.java     | 18 +++++++++++++++
 2 files changed, 44 insertions(+)

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 b62a026..03d12a1 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
@@ -29,6 +29,7 @@ import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.regex.Pattern;
@@ -268,6 +269,15 @@ public class DeployFileMojo extends AbstractDeployMojo {
                         Files.copy(pomInputStream, pomFile, 
StandardCopyOption.REPLACE_EXISTING);
 
                         processModel(readModel(pomFile));
+                        JarEntry propertiesEntry =
+                                
jarFile.getJarEntry(entry.getName().replace("pom.xml", "pom.properties"));
+                        if (propertiesEntry != null) {
+                            try (InputStream propertiesInputStream = 
jarFile.getInputStream(propertiesEntry)) {
+                                Properties properties = new Properties();
+                                properties.load(propertiesInputStream);
+                                processPomProperties(properties);
+                            }
+                        }
 
                         return pomFile;
                     }
@@ -593,6 +603,22 @@ public class DeployFileMojo extends AbstractDeployMojo {
         }
     }
 
+    void processPomProperties(Properties properties) {
+        if (isUnresolvedProperty(groupId)) {
+            groupId = properties.getProperty("groupId", groupId);
+        }
+        if (isUnresolvedProperty(artifactId)) {
+            artifactId = properties.getProperty("artifactId", artifactId);
+        }
+        if (isUnresolvedProperty(version)) {
+            version = properties.getProperty("version", version);
+        }
+    }
+
+    private static boolean isUnresolvedProperty(String value) {
+        return value != null && value.startsWith("${") && value.endsWith("}");
+    }
+
     /**
      * Extract the model from the specified POM file.
      *
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 50e0e1d..76d6962 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoUnitTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Properties;
 
 import org.apache.maven.api.model.Model;
 import org.apache.maven.api.model.Parent;
@@ -103,6 +104,23 @@ class DeployFileMojoUnitTest {
         checkMojoProperties("groupO", "artifactO", "versionO", "packagingO");
     }
 
+    @Test
+    void processResolvedVersionFromPomProperties() {
+        mojo.setGroupId("${group}");
+        mojo.setArtifactId("${artifact}");
+        mojo.setVersion("${revision}");
+        Properties properties = new Properties();
+        properties.setProperty("groupId", "org.example");
+        properties.setProperty("artifactId", "example");
+        properties.setProperty("version", "1.2.3");
+
+        mojo.processPomProperties(properties);
+
+        assertEquals("org.example", mojo.getGroupId());
+        assertEquals("example", mojo.getArtifactId());
+        assertEquals("1.2.3", mojo.getVersion());
+    }
+
     private void checkMojoProperties(
             final String expectedGroup,
             final String expectedArtifact,

Reply via email to