[
https://issues.apache.org/jira/browse/MNG-7443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17562441#comment-17562441
]
ASF GitHub Bot commented on MNG-7443:
-------------------------------------
mthmulders commented on code in PR #701:
URL: https://github.com/apache/maven/pull/701#discussion_r913499478
##########
maven-core/src/main/java/org/apache/maven/graph/ProjectSelector.java:
##########
@@ -0,0 +1,144 @@
+package org.apache.maven.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.MavenExecutionException;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+
+public final class ProjectSelector
Review Comment:
Would it be possible to add unit tests for this new class?
##########
maven-core/src/main/java/org/apache/maven/DefaultMaven.java:
##########
@@ -631,6 +638,21 @@ private void validateRequiredProfiles( MavenSession
session, ProfileActivation p
}
}
+ /**
+ * Check whether any of the requested optional projects were not activated
or deactivated.
+ * @param request the {@link MavenExecutionRequest}.
+ * @param session the {@link MavenSession}.
+ */
+ private void validateOptionalProjects( MavenExecutionRequest request,
MavenSession session )
+ {
+ final ProjectActivation projectActivation =
request.getProjectActivation();
+ final Set<String> allOptionalSelectors = Sets.union(
projectActivation.getOptionalActiveProjectSelectors(),
Review Comment:
Do we really need `Sets.union` here? If we want to know the combination of
optional active project selectors and optional inactive project selectors,
can't we create a new `Set` and put all items from both backing sets in it?
Since `Set` does not allow duplicate elements, I guess we would have the
same result - but without using an external lib for it. It's two lines more
code this way, but at least we don't increase our dependency on Guava or Google
Collections or whatnot.
> Consistent logging between optional projects and optional profiles
> ------------------------------------------------------------------
>
> Key: MNG-7443
> URL: https://issues.apache.org/jira/browse/MNG-7443
> Project: Maven
> Issue Type: Improvement
> Components: Core, Logging
> Affects Versions: 4.0.0-alpha-1
> Reporter: Giovanni van der Schelde
> Priority: Minor
> Attachments: example.png
>
>
> Maven 4 introduces optional profiles and optional projects. However, the
> feedback provided to the user on whether a project or profile has been
> skipped is inconsistent between the two (see image attached).
> For profiles, it will be logged twice: before and after the build.
> For projects, it will be logged once: before the build.
> The idea would be to log the information for skipped optional projects after
> the build as well.
> !example.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)