You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/03/22 15:15:31 UTC

[GitHub] [maven] MartinKanters commented on a change in pull request #458: [MNG-7102] Exclude all children of aggregators, even if the aggregator was already removed from the reactor.

MartinKanters commented on a change in pull request #458:
URL: https://github.com/apache/maven/pull/458#discussion_r598808801



##########
File path: maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##########
@@ -280,24 +281,12 @@ public DefaultGraphBuilder( BuildResumptionDataRepository buildResumptionDataRep
         if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
         {
             Set<MavenProject> excludedProjects = new HashSet<>( requiredSelectors.size() + optionalSelectors.size() );
-            excludedProjects.addAll( getProjectsBySelectors( request, projects, requiredSelectors, true ) );
-            excludedProjects.addAll( getProjectsBySelectors( request, projects, optionalSelectors, false ) );
+            List<MavenProject> allProjects = graph.getAllProjects();
+            excludedProjects.addAll( getProjectsBySelectors( request, allProjects, requiredSelectors, true ) );
+            excludedProjects.addAll( getProjectsBySelectors( request, allProjects, optionalSelectors, false ) );
 
             result = new ArrayList<>( projects );
-
-            for ( MavenProject excludedProject : excludedProjects )
-            {
-                boolean isExcludedProjectRemoved = result.remove( excludedProject );
-
-                if ( isExcludedProjectRemoved )
-                {
-                    List<MavenProject> children = excludedProject.getCollectedProjects();
-                    if ( children != null )
-                    {
-                        result.removeAll( children );
-                    }
-                }
-            }

Review comment:
       If you are wondering why this has been removed, this is because we made a mistake during an earlier merge. The children are already collected in the `getProjectsBySelectors` method which is called on line 285 and 286. The removed code would be redundant.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org