apache/maven · error · MissingProjectException

The goal you specified requires a project to execute but the

Error message

The goal you specified requires a project to execute but there is no POM in this directory ({}). Please verify you invoked Maven from the correct directory.

What it means

The concurrent-build variant of the starter check: ConcurrentLifecycleStarter.execute() throws MissingProjectException when the requested tasks require a project but none is present. Same semantics as DefaultLifecycleStarter's check, reported against session.getTopDirectory(); it runs on the concurrent-execution code path.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/ConcurrentLifecycleStarter.java:87

            ExecutionEventCatapult eventCatapult,
            DefaultLifecycles defaultLifeCycles,
            BuildPlanExecutor executor,
            LifecyclePluginResolver lifecyclePluginResolver,
            MojoDescriptorCreator mojoDescriptorCreator) {
        this.eventCatapult = eventCatapult;
        this.defaultLifeCycles = defaultLifeCycles;
        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));

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Run Maven from the directory that contains pom.xml
  2. Or specify the POM: mvn -f path/to/pom.xml <goals>
  3. Verify the CI checkout actually contains the POM at the expected path before invoking
  4. If no project is intended, use only goals marked requiresProject=false

Example fix

# before
mvn -f missing-dir/pom.xml package   # POM absent -> MissingProjectException

# after
mvn -f /repo/module-a/pom.xml package
Defensive patterns

Strategy: validation

Validate before calling

// embedders using ConcurrentLifecycleStarter: verify project presence first
if (requiresProject(session) && !Files.exists(session.getTopDirectory().resolve("pom.xml"))) {
    throw new MissingProjectException("No POM in " + session.getTopDirectory());
}

Try / catch

catch (MissingProjectException e) {
    // point the session at the right top directory (or -f) and re-execute
}

Prevention

When it happens

Trigger: Executing a project-requiring build with the concurrent lifecycle starter (e.g. the experimental/concurrent builder or embedder using ConcurrentLifecycleStarter) in a directory with no pom.xml, or with the POM argument missing so requiresProject(session) && projectIsNotPresent(session) holds.

Common situations: CI jobs or IDE embedders enabling the concurrent implementation and running from the wrong working directory; scripts reusing Maven invocations without -f; workspaces where the POM lives in a submodule directory.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/93a23b611d09676e. Report an issue: GitHub.