diff --git a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java index 222a1ecd77e4..7e07c2de2830 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java +++ b/impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlan.java @@ -25,6 +25,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -85,7 +86,7 @@ public Optional step(MavenProject project, String name) { } public BuildStep requiredStep(MavenProject project, String name) { - return step(project, name).get(); + return step(project, name).orElseThrow(() -> new NoSuchElementException("Step " + name + " not found")); } // add a follow-up plan to this one