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



##########
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:
       Interesting question, the `DefaultGraphBuilder` will first filter based 
on the selected modules (+), afterwards it will filter out the excluded 
projects, so in this case nothing will be selected. Actually, it will result in 
a bug (I'll create a JIRA ticket for it)
   
   This is an attempt in the integration-test project:
   ```
   >mvn validate -pl !core-it-suite,+core-it-suite
   [INFO] Scanning for projects...
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] 
------------------------------------------------------------------------
   [INFO] Total time:  0.630 s
   [INFO] Finished at: 2021-02-14T20:15:52+01:00
   [INFO] 
------------------------------------------------------------------------
   [ERROR] No goals have been specified for this build. You must specify a 
valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or 
<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available 
lifecycle phases are: validate, initialize, generate-sources, process-sources, 
generate-reso
   urces, process-resources, compile, process-classes, generate-test-sources, 
process-test-sources, generate-test-resources, process-test-resources, 
test-compile, process-test-classes, test, prepare-package, package, 
pre-integration-test, integration-test, post-integration-test, verify, install, 
deploy, pre-clean,
    clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]```




----------------------------------------------------------------
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