You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/06/20 08:40:09 UTC

[maven] 02/30: Refactored the getResumeFromSelector logic to be compliant with checkstyle rules.

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

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

commit caf386ea2ec5c65b4fc05c5f7e5f9442cb17be89
Author: Martin Kanters <Ma...@infosupport.com>
AuthorDate: Fri May 22 09:04:45 2020 +0200

    Refactored the getResumeFromSelector logic to be compliant with checkstyle rules.
---
 .../java/org/apache/maven/cli/BuildResumptionManager.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/BuildResumptionManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/BuildResumptionManager.java
index 7820c0a..ecabc81 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/BuildResumptionManager.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/BuildResumptionManager.java
@@ -167,13 +167,15 @@ class BuildResumptionManager
      */
     public String getResumeFromSelector( List<MavenProject> mavenProjects, MavenProject failedProject )
     {
-        for ( MavenProject buildProject : mavenProjects )
+        boolean hasOverlappingArtifactId = mavenProjects.stream()
+                .filter( project -> failedProject.getArtifactId().equals( project.getArtifactId() ) )
+                .count() > 1;
+
+        if ( hasOverlappingArtifactId )
         {
-            if ( failedProject.getArtifactId().equals( buildProject.getArtifactId() ) && !failedProject.equals( buildProject ) )
-            {
-                return failedProject.getGroupId() + ":" + failedProject.getArtifactId();
-            }
+            return failedProject.getGroupId() + ":" + failedProject.getArtifactId();
         }
+
         return ":" + failedProject.getArtifactId();
     }