From 42af8ba5a21dc085d065cfa0b4c5557fb40ad7ac Mon Sep 17 00:00:00 2001 From: Martin Kanters Date: Wed, 9 Sep 2020 18:12:31 +0200 Subject: [PATCH] [MNG-6981] Include the child projects (modules) of the selected projects with --pl in the reactor. This closes #374. --- .../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 31cd25815d..14f114d640 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 selectedProjects = new LinkedHashSet<>( request.getSelectedProjects().size(), 1 ); + Collection 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 children = selectedProject.getCollectedProjects(); + if ( children != null ) + { + selectedProjects.addAll( children ); + } } result = new ArrayList<>( selectedProjects );