mirror of https://github.com/apache/maven.git
[MNG-7672] Fork should only execute the project and its submodules (#968)
This commit is contained in:
parent
fbeefb85ab
commit
30fafa6741
|
@ -30,6 +30,8 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
@ -88,12 +90,18 @@ public class LifecycleDependencyResolver {
|
|||
|
||||
public static List<MavenProject> getProjects(MavenProject project, MavenSession session, boolean aggregator) {
|
||||
if (aggregator) {
|
||||
return session.getProjects();
|
||||
return getProjectAndSubModules(project).collect(Collectors.toList());
|
||||
} else {
|
||||
return Collections.singletonList(project);
|
||||
}
|
||||
}
|
||||
|
||||
private static Stream<MavenProject> getProjectAndSubModules(MavenProject project) {
|
||||
return Stream.concat(
|
||||
Stream.of(project),
|
||||
project.getCollectedProjects().stream().flatMap(LifecycleDependencyResolver::getProjectAndSubModules));
|
||||
}
|
||||
|
||||
public void resolveProjectDependencies(
|
||||
MavenProject project,
|
||||
Collection<String> scopesToCollect,
|
||||
|
|
Loading…
Reference in New Issue