apache/maven · error · NoGoalSpecifiedException
No goals have been specified for this build. You must specif
Error message
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: {}. What it means
ConcurrentLifecycleStarter throws NoGoalSpecifiedException when calculateTaskSegments() returns an empty list: no valid lifecycle phase or plugin goal was supplied to the (concurrent-path) build. The message enumerates all accepted phase names and the goal syntax.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/ConcurrentLifecycleStarter.java:94
this.executor = executor;
this.lifecyclePluginResolver = lifecyclePluginResolver;
this.mojoDescriptorCreator = mojoDescriptorCreator;
}
@Override
public void execute(MavenSession session) {
eventCatapult.fire(ExecutionEvent.Type.SessionStarted, session, null);
try {
if (requiresProject(session) && projectIsNotPresent(session)) {
throw new MissingProjectException("The goal you specified requires a project to execute"
+ " but there is no POM in this directory (" + session.getTopDirectory() + ")."
+ " Please verify you invoked Maven from the correct directory.");
}
List<TaskSegment> taskSegments = calculateTaskSegments(session);
if (taskSegments.isEmpty()) {
throw new NoGoalSpecifiedException("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: " + defaultLifeCycles.getLifecyclePhaseList() + ".");
}
int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
if (degreeOfConcurrency > 1) {
logger.info("");
logger.info(String.format(
"Using the %s implementation with a thread count of %d",
executor.getClass().getSimpleName(), degreeOfConcurrency));
}
ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus(session.getProjectDependencyGraph());
ReactorContext reactorContext =
new ReactorContext(session.getResult(), oldContextClassLoader, reactorBuildStatus);
executor.execute(session, reactorContext, taskSegments);View on GitHub (pinned to e4093d4e12)
Solutions
- Pass an explicit phase or goal: mvn verify / mvn plugin:goal
- Set <default-goal> in the POM's <build> if you want bare 'mvn' to do something
- Fix scripts so the goal variable cannot be empty: mvn ${GOALS:-install}
Example fix
<!-- before: bare 'mvn' with no default-goal -> NoGoalSpecifiedException --> <!-- after: pom.xml --> <build> <default-goal>verify</default-goal> </build>
Defensive patterns
Strategy: validation
Validate before calling
// reject empty task lists before executing the session
if (taskSegments == null || taskSegments.isEmpty()) {
throw new IllegalArgumentException("No goals specified - pass a phase or <plugin>:<goal>");
} Try / catch
catch (NoGoalSpecifiedException e) {
// supply a default phase (package/verify) and retry the session
} Prevention
- Default goal variables in scripts: mvn ${GOALS:-verify}
- Configure <default-goal> for repos where bare 'mvn' is expected to work
- Log the resolved goal list before execution in wrappers
When it happens
Trigger: Invoking the concurrent starter with no goals (bare 'mvn'), with only options/properties, or with task strings that the task-segment calculator could not map to any phase or goal; also programmatic sessions whose task list is empty.
Common situations: CI scripts with an empty GOALS variable; wrapper scripts appending goals conditionally and the condition evaluating false; users expecting an implicit default goal other than the POM's <default-goal> (which, if unset, leaves nothing to run).
Related errors
- No goals have been specified for this build. You must specif
- The goal you specified requires a project to execute but the
- Unknown lifecycle phase "{}". You must specify a valid lifec
- Illegal call to phase '{}'. The main phase '{}' will be used
- Unbounded range: {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/ee5573c51f507a3f.
Report an issue: GitHub.