Skip to content

/errors/maven/no-pom-in-this-directory

The goal you specified requires a project to execute but there is no POM in this directory

The commands on this page have not been executed by our verification runner yet.updated
tool
Maven
exit code
1
versions
Maven 3.x, Maven 4
os
any

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/path). Please verify you invoked Maven from the correct directory. means Maven was asked to run a project goal (compile, test, package, install, dependency:tree...) in a folder that has no pom.xml. Maven does not search parent or child folders. cd into the folder that contains pom.xml, or pass it explicitly with mvn -f path/to/pom.xml package.

Typical output

text
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/user/work). Please verify you invoked Maven from the correct directory. -> [Help 1]
...
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

The path in parentheses is the directory Maven looked in. The Help link names the exception, MissingProjectException.

Fix

bash
ls pom.xml                       # is it here?
cd backend && mvn package        # the project lives in a subfolder
mvn -f backend/pom.xml package   # or point to it without changing directory

In CI and Docker

EnvironmentWhat to set
GitHub Actionsworking-directory: backend on the step, or mvn -f backend/pom.xml
GitLab CIcd backend in script, or -f backend/pom.xml
Jenkinsdir("backend") { sh "mvn package" }
DockerfileWORKDIR /app, COPY pom.xml . and COPY src ./src before RUN mvn package

Goals that do not need a project, such as mvn archetype:generate to create one, run anywhere. Multi-module builds are started from the folder of the parent (aggregator) pom.xml; use -pl module-name -am to build one module from there.

Sources