This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 2f7b9623fc91bbe609d46270e662c5db11ec42bf
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Fri Oct 18 08:40:19 2024 +0200

    [MNG-8325] The ReactorReader should know about build/consumer POMs
---
 .../main/java/org/apache/maven/ReactorReader.java   | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/maven-core/src/main/java/org/apache/maven/ReactorReader.java 
b/maven-core/src/main/java/org/apache/maven/ReactorReader.java
index edba95447f..ea4af1e986 100644
--- a/maven-core/src/main/java/org/apache/maven/ReactorReader.java
+++ b/maven-core/src/main/java/org/apache/maven/ReactorReader.java
@@ -43,6 +43,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import org.apache.maven.api.feature.Features;
 import org.apache.maven.api.model.Model;
 import org.apache.maven.api.services.Lookup;
 import org.apache.maven.eventspy.EventSpy;
@@ -412,7 +413,20 @@ class ReactorReader implements MavenWorkspaceReader {
     }
 
     private void installIntoProjectLocalRepository(Artifact artifact) {
-        Path target = getArtifactPath(artifact);
+        String extension = artifact.getExtension();
+        String classifier = artifact.getClassifier();
+        if (Features.consumerPom(session.getUserProperties())) {
+            if ("pom".equals(extension)) {
+                if (classifier == null || classifier.isEmpty()) {
+                    classifier = "build";
+                } else if (classifier.equals("consumer")) {
+                    classifier = null;
+                }
+            }
+        }
+
+        Path target = getArtifactPath(
+                artifact.getGroupId(), artifact.getArtifactId(), 
artifact.getVersion(), classifier, extension);
         try {
             LOGGER.info("Copying {} to project local repository", artifact);
             Files.createDirectories(target.getParent());
@@ -432,6 +446,11 @@ class ReactorReader implements MavenWorkspaceReader {
         String version = artifact.getBaseVersion();
         String classifier = artifact.getClassifier();
         String extension = artifact.getExtension();
+        return getArtifactPath(groupId, artifactId, version, classifier, 
extension);
+    }
+
+    private Path getArtifactPath(
+            String groupId, String artifactId, String version, String 
classifier, String extension) {
         Path repo = getProjectLocalRepo();
         return repo.resolve(groupId)
                 .resolve(artifactId)

Reply via email to