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 );