MartinKanters commented on a change in pull request #446:
URL: https://github.com/apache/maven/pull/446#discussion_r576385701



##########
File path: 
maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
##########
@@ -242,21 +274,17 @@ public DefaultGraphBuilder( BuildResumptionDataRepository 
buildResumptionDataRep
     {
         List<MavenProject> result = projects;
 
-        if ( !request.getExcludedProjects().isEmpty() )
+        ProjectActivation projectActivation = request.getProjectActivation();
+        Set<String> requiredSelectors = 
projectActivation.getRequiredInactiveProjectSelectors();
+        Set<String> optionalSelectors = 
projectActivation.getOptionalInactiveProjectSelectors();
+        if ( !requiredSelectors.isEmpty() || !optionalSelectors.isEmpty() )
         {
-            File reactorDirectory = getReactorDirectory( request );
+            Set<MavenProject> excludedProjects = new HashSet<>( 
requiredSelectors.size() + optionalSelectors.size() );
+            excludedProjects.addAll( getProjectsBySelectors( request, 
projects, requiredSelectors, true ) );
+            excludedProjects.addAll( getProjectsBySelectors( request, 
projects, optionalSelectors, false ) );

Review comment:
       Right, the data structure inside `ProjectActivation` is a 
`Map<(ProjectSelector)String, (enum)ActivationSetting>`, so that means that a 
project cannot be both turned selected and excluded. The one who gets set later 
wins (in `-pl !a,+a` '+a' wins).
   This was not fully intentional, but I don't dislike the outcome. The same 
goes for ProfileActivation, by the way.
   
   The bug remains though if the user invokes `mvn -pl -a,+:a` (same proj, 
different selector). It will output "No goals have been specified for this 
build.". I'll improve the error message in this case.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to