mirror of https://github.com/apache/maven.git
[MNG-7390] Allow selecting modules outside the cwd into the reactor using --projects
This closes #677
This commit is contained in:
parent
b2a21f12f8
commit
03df5f7c63
|
@ -138,8 +138,10 @@ public class DefaultGraphBuilder
|
|||
{
|
||||
ProjectDependencyGraph projectDependencyGraph = new DefaultProjectDependencyGraph( projects );
|
||||
List<MavenProject> activeProjects = projectDependencyGraph.getSortedProjects();
|
||||
List<MavenProject> allSortedProjects = projectDependencyGraph.getSortedProjects();
|
||||
activeProjects = trimProjectsToRequest( activeProjects, projectDependencyGraph, session.getRequest() );
|
||||
activeProjects = trimSelectedProjects( activeProjects, projectDependencyGraph, session.getRequest() );
|
||||
activeProjects = trimSelectedProjects(
|
||||
activeProjects, allSortedProjects, projectDependencyGraph, session.getRequest() );
|
||||
activeProjects = trimResumedProjects( activeProjects, projectDependencyGraph, session.getRequest() );
|
||||
activeProjects = trimExcludedProjects( activeProjects, projectDependencyGraph, session.getRequest() );
|
||||
|
||||
|
@ -171,8 +173,8 @@ public class DefaultGraphBuilder
|
|||
return result;
|
||||
}
|
||||
|
||||
private List<MavenProject> trimSelectedProjects( List<MavenProject> projects, ProjectDependencyGraph graph,
|
||||
MavenExecutionRequest request )
|
||||
private List<MavenProject> trimSelectedProjects( List<MavenProject> projects, List<MavenProject> allSortedProjects,
|
||||
ProjectDependencyGraph graph, MavenExecutionRequest request )
|
||||
throws MavenExecutionException
|
||||
{
|
||||
List<MavenProject> result = projects;
|
||||
|
@ -183,8 +185,10 @@ public class DefaultGraphBuilder
|
|||
if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
|
||||
{
|
||||
Set<MavenProject> selectedProjects = new HashSet<>( requiredSelectors.size() + optionalSelectors.size() );
|
||||
selectedProjects.addAll( getProjectsBySelectors( request, projects, requiredSelectors, true ) );
|
||||
selectedProjects.addAll( getProjectsBySelectors( request, projects, optionalSelectors, false ) );
|
||||
selectedProjects.addAll(
|
||||
getProjectsBySelectors( request, allSortedProjects, requiredSelectors, true ) );
|
||||
selectedProjects.addAll(
|
||||
getProjectsBySelectors( request, allSortedProjects, optionalSelectors, false ) );
|
||||
|
||||
// it can be empty when an optional project is missing from the reactor, fallback to returning all projects
|
||||
if ( !selectedProjects.isEmpty() )
|
||||
|
|
Loading…
Reference in New Issue