You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2021/10/08 13:01:35 UTC

[maven] branch MNG-7276 updated (cdf5971 -> b5acda4)

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

khmarbaise pushed a change to branch MNG-7276
in repository https://gitbox.apache.org/repos/asf/maven.git.


    from cdf5971  Continued.
     new 65dbef5  Continued.
     new b5acda4  Cleaned up.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/maven/DefaultMaven.java   | 36 ++++++++++++----------
 .../main/java/org/apache/maven/ReactorReader.java  | 27 +++++++++-------
 2 files changed, 35 insertions(+), 28 deletions(-)

[maven] 02/02: Cleaned up.

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MNG-7276
in repository https://gitbox.apache.org/repos/asf/maven.git

commit b5acda4d9ac29b8af2176114239227d1a8c77cac
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Fri Oct 8 15:00:57 2021 +0200

    Cleaned up.
---
 .../main/java/org/apache/maven/DefaultMaven.java   | 36 ++++++++++++----------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index cae176d..786b755 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -19,6 +19,22 @@ package org.apache.maven;
  * under the License.
  */
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.execution.BuildResumptionAnalyzer;
 import org.apache.maven.execution.BuildResumptionDataRepository;
@@ -58,20 +74,6 @@ import org.slf4j.LoggerFactory;
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Stream;
 
 import static java.util.stream.Collectors.toSet;
 
@@ -250,7 +252,7 @@ public class DefaultMaven
 
         eventCatapult.fire( ExecutionEvent.Type.ProjectDiscoveryStarted, session, null );
 
-        Result<? extends ProjectDependencyGraph> graphResult = buildGraph( session, result );
+        Result<? extends ProjectDependencyGraph> graphResult = buildGraph( session );
 
         if ( graphResult.hasErrors() )
         {
@@ -306,7 +308,7 @@ public class DefaultMaven
         // not expected that a participant will add or remove projects from the session.
         //
 
-        graphResult = buildGraph( session, result );
+        graphResult = buildGraph( session );
 
         if ( graphResult.hasErrors() )
         {
@@ -671,7 +673,7 @@ public class DefaultMaven
         return index;
     }
 
-    private Result<? extends ProjectDependencyGraph> buildGraph( MavenSession session, MavenExecutionResult result )
+    private Result<? extends ProjectDependencyGraph> buildGraph( MavenSession session )
     {
         Result<? extends ProjectDependencyGraph> graphResult = graphBuilder.build( session );
         for ( ModelProblem problem : graphResult.getProblems() )

[maven] 01/02: Continued.

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MNG-7276
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 65dbef52e2a93b1f056e6ff77eec200e9e3898dd
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Fri Oct 8 14:45:26 2021 +0200

    Continued.
---
 .../main/java/org/apache/maven/ReactorReader.java  | 27 +++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)

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 1521b1b..e50eabb 100644
--- a/maven-core/src/main/java/org/apache/maven/ReactorReader.java
+++ b/maven-core/src/main/java/org/apache/maven/ReactorReader.java
@@ -34,6 +34,7 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.function.Function;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -325,22 +326,26 @@ class ReactorReader
         }
 
         return RepositoryUtils.toArtifacts( project.getAttachedArtifacts() ).stream()
-                .filter( artifact -> attachedArtifactComparison( requestedArtifact, artifact ) )
+                .filter( isRequestedArtifact( requestedArtifact ) )
                 .findFirst()
                 .orElse( null );
     }
 
-    private boolean attachedArtifactComparison( Artifact requested, Artifact attached )
+    /**
+     * We are taking as much as we can from the DefaultArtifact.equals(). The requested artifact has no file, so we want
+     * to remove that from the comparison.
+     *
+     * @param requestArtifact checked against the given artifact.
+     * @return true if equals, false otherwise.
+     */
+    private Predicate<Artifact> isRequestedArtifact( Artifact requestArtifact )
     {
-        //
-        // We are taking as much as we can from the DefaultArtifact.equals(). The requested artifact has no file so
-        // we want to remove that from the comparison.
-        //
-        return requested.getArtifactId().equals( attached.getArtifactId() )
-            && requested.getGroupId().equals( attached.getGroupId() )
-            && requested.getVersion().equals( attached.getVersion() )
-            && requested.getExtension().equals( attached.getExtension() )
-            && requested.getClassifier().equals( attached.getClassifier() );
+        return s -> s.getArtifactId().equals( requestArtifact.getArtifactId() )
+                && s.getGroupId().equals( requestArtifact.getGroupId() )
+                && s.getVersion().equals( requestArtifact.getVersion() )
+                && s.getExtension().equals( requestArtifact.getExtension() )
+                && s.getClassifier().equals( requestArtifact.getClassifier() );
+
     }
 
     /**