[MNG-7102] The child modules of excluded projects are now excluded as well, making the behavior consistent with MNG-6981.

This commit is contained in:
Martin Kanters 2021-02-20 11:37:17 +01:00 committed by Martin Kanters
parent 3e656376e8
commit a02834611b
2 changed files with 14 additions and 1 deletions

View File

@ -255,7 +255,17 @@ public class DefaultGraphBuilder
.findFirst()
.orElseThrow( () -> new MavenExecutionException( "Could not find the selected project in "
+ "the reactor: " + selector, request.getPom() ) );
result.remove( excludedProject );
boolean isExcludedProjectRemoved = result.remove( excludedProject );
if ( isExcludedProjectRemoved )
{
List<MavenProject> children = excludedProject.getCollectedProjects();
if ( children != null )
{
result.removeAll( children );
}
}
}
}

View File

@ -147,6 +147,9 @@ public class DefaultGraphBuilderTest
.excludedProjects( MODULE_B )
.makeBehavior( REACTOR_MAKE_UPSTREAM )
.expectResult( PARENT_MODULE, MODULE_C, MODULE_A, MODULE_C_2 ),
scenario( "Excluding a project also excludes its children" )
.excludedProjects( MODULE_C )
.expectResult( PARENT_MODULE, MODULE_A, MODULE_B, INDEPENDENT_MODULE ),
scenario( "Excluding an also make dependency from resumeFrom does take its transitive dependency" )
.resumeFrom( MODULE_C_2 )
.excludedProjects( MODULE_B )