gnodet-bot commented on code in PR #14025:
URL: https://github.com/apache/maven/pull/14025#discussion_r4589022505


##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5885LogParserTest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import org.junit.jupiter.api.Test;
+
+import java.nio.file.Path;

Review Comment:
   🔧 **Import ordering**: project convention is `java.*` before `org.*`. Swap 
these two import blocks.
   
   ```suggestion
   import java.nio.file.Path;
   
   import org.junit.jupiter.api.Test;
   ```



##########
impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java:
##########
@@ -233,13 +241,26 @@ public List<MojoExecution> 
calculateMojoExecutions(MavenSession session, MavenPr
                 Map<String, List<MojoExecution>> phaseToMojoMapping =
                         calculateLifecycleMappings(session, project, 
lifecyclePhase);
 
+                Set<String> alreadyPlannedPhases = mojoExecutions.stream()
+                        .map(MojoExecution::getLifecyclePhase)
+                        .filter(Objects::nonNull)
+                        .collect(Collectors.toSet());
+
                 for (List<MojoExecution> mojoExecutionsFromLifecycle : 
phaseToMojoMapping.values()) {
+                    mojoExecutionsFromLifecycle.stream()
+                            .map(MojoExecution::getLifecyclePhase)
+                            .filter(alreadyPlannedPhases::contains)
+                            .forEach(duplicateLifecyclePhases::add);
                     mojoExecutions.addAll(mojoExecutionsFromLifecycle);
                 }
+
             } else {
                 throw new IllegalStateException("unexpected task " + task);
             }
         }
+        if (!duplicateLifecyclePhases.isEmpty()) {
+            LOG.warn("The given lifecycle phases overlap. If this is not 
intended, you should check your Maven Build.");

Review Comment:
   ⚠️ **Warning discards the collected phase names** — 
`duplicateLifecyclePhases` is a `LinkedHashSet` that contains exactly which 
phases overlap, but the message is a static string. The user is told phases 
overlap without knowing *which* ones, so they cannot act on it. Include the set 
in the message:
   
   ```suggestion
           if (!duplicateLifecyclePhases.isEmpty()) {
               LOG.warn(
                       "The following lifecycle phases overlap and will cause 
some plugins to execute multiple times: {}."
                               + " If this is not intended, review the phases 
passed on the command line.",
                       duplicateLifecyclePhases);
           }
   ```



##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5885LogParserTest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import org.junit.jupiter.api.Test;
+
+import java.nio.file.Path;
+
+public class MavenITmng5885LogParserTest extends 
AbstractMavenIntegrationTestCase {
+
+    private static final String OVERLAP_WARNING = "The given lifecycle phases 
overlap. " +
+            "If this is not intended, you should check your Maven Build.";
+
+    /**
+     * Test that executes 'mvn clean packe compile'.

Review Comment:
   📝 **Javadoc typo + phantom arg**: `'mvn clean packe compile'` has two issues 
— `packe` should be `package`, and the test never adds `clean` as a CLI 
argument (only `package` and `compile` are added).
   
   ```suggestion
        * Test that executes 'mvn package compile'.
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to