diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java index e755aa904c46..e0bf6414ec8a 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java @@ -21,6 +21,7 @@ import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -96,7 +97,9 @@ public static List getProjects( MavenProject project, MavenSession { if ( aggregator ) { - return session.getProjects(); + List projects = new ArrayList<>(); + addProjectAndSubModules( projects, project ); + return projects; } else { @@ -104,6 +107,16 @@ public static List getProjects( MavenProject project, MavenSession } } + private static void addProjectAndSubModules( List projects, MavenProject project ) + { + projects.add( project ); + for ( MavenProject submodule : project.getCollectedProjects() ) + { + addProjectAndSubModules( projects, submodule ); + } + } + + public void resolveProjectDependencies( MavenProject project, Collection scopesToCollect, Collection scopesToResolve, MavenSession session, boolean aggregating, Set projectArtifacts )