gnodet commented on code in PR #13233:
URL: https://github.com/apache/maven/pull/13233#discussion_r4071797520
##########
impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java:
##########
@@ -681,6 +707,32 @@ private void plan() {
}
}
+ /**
+ * Expands the set of explicitly skipped phase names to include all
their descendant
+ * (child/sub) phases in the lifecycle DAG.
+ *
+ * <p>When a user specifies {@code --skip-phases=verify}, all mojos
bound to sub-phases
+ * of {@code verify} (e.g. {@code test}, {@code unit-test}, {@code
integration-test}) must
+ * also be skipped, since those sub-phases are part of the skipped
phase.</p>
+ *
+ * @param explicit the set of phase names explicitly listed in {@code
--skip-phases}
+ * @return a new set containing the original phase names plus all
their descendants
+ */
+ private Set<String> expandSkippedPhases(Set<String> explicit) {
Review Comment:
Fixed in 72b8d24c579a90885710aab3c4ba70c906211a1f: injected
`LifecycleRegistry` into `DefaultLifecycleExecutionPlanCalculator` and added
`expandSkippedPhases()` — same logic as `BuildPlanExecutor`. Both builders now
expand `--skip-phases=verify` to include all descendant sub-phases. Unit test
`skipParentPhaseAlsoFiltersSubPhases` added to pin the sequential path.
##########
impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java:
##########
@@ -211,6 +211,9 @@ public List<MojoExecution>
calculateMojoExecutions(MavenSession session, MavenPr
MojoNotFoundException, NoPluginFoundForPrefixException,
InvalidPluginDescriptorException,
PluginVersionResolutionException,
LifecyclePhaseNotFoundException {
final List<MojoExecution> mojoExecutions = new ArrayList<>();
+ final Set<String> skippedPhases = session.getRequest() != null
+ ? new HashSet<>(session.getRequest().getSkippedPhases())
+ : Set.of();
Review Comment:
Fixed in 72b8d24c579a90885710aab3c4ba70c906211a1f.
`DefaultLifecycleExecutionPlanCalculator` now has its own
`expandSkippedPhases()` backed by the injected `LifecycleRegistry`. The
exact-match filter is gone — both builders use the same expansion semantics.
##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng13230SkipPhasesTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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 java.nio.file.Path;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Integration tests for the {@code --skip-phases} and {@code --skip-tests}
CLI options
+ * introduced by <a
href="https://github.com/apache/maven/issues/13230">GH-13230</a>,
+ * and the lifecycle DAG change that makes {@code install} and {@code deploy}
depend on
+ * {@code verify} (so that {@code mvn install} always runs {@code verify}).
+ *
+ * @since 4.1.0
+ */
+class MavenITmng13230SkipPhasesTest extends AbstractMavenIntegrationTestCase {
+
+ /**
+ * Verify that {@code --skip-phases=test} suppresses mojo executions bound
to
+ * the {@code test} phase (e.g. maven-surefire-plugin) while still running
+ * the phases leading up to and after it.
+ */
+ @Test
+ void skipPhasesSupressesMojosForSkippedPhase() throws Exception {
Review Comment:
Fixed in 72b8d24c579a90885710aab3c4ba70c906211a1f: renamed to
`skipPhasesSuppressesMojosForSkippedPhase` (double 'p').
--
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]