You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2020/10/19 18:15:47 UTC

[maven] branch master updated: [MNG-6981] Include the child projects (modules) of the selected projects with --pl in the reactor.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 42af8ba  [MNG-6981] Include the child projects (modules) of the selected projects with --pl in the reactor.
42af8ba is described below

commit 42af8ba5a21dc085d065cfa0b4c5557fb40ad7ac
Author: Martin Kanters <ma...@apache.org>
AuthorDate: Wed Sep 9 18:12:31 2020 +0200

    [MNG-6981] Include the child projects (modules) of the selected projects with --pl in the reactor.
    
    This closes #374.
---
 .../src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
index 31cd258..14f114d 100644
--- a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
@@ -180,7 +180,7 @@ public class DefaultGraphBuilder
         {
             File reactorDirectory = getReactorDirectory( request );
 
-            Collection<MavenProject> selectedProjects = new LinkedHashSet<>( request.getSelectedProjects().size(), 1 );
+            Collection<MavenProject> selectedProjects = new LinkedHashSet<>();
 
             for ( String selector : request.getSelectedProjects() )
             {
@@ -190,6 +190,12 @@ public class DefaultGraphBuilder
                         .orElseThrow( () -> new MavenExecutionException(
                                 "Could not find the selected project in the reactor: " + selector, request.getPom() ) );
                 selectedProjects.add( selectedProject );
+
+                List<MavenProject> children = selectedProject.getCollectedProjects();
+                if ( children != null )
+                {
+                    selectedProjects.addAll( children );
+                }
             }
 
             result = new ArrayList<>( selectedProjects );