Updated on 2023-11-28 GMT+08:00

POM Not Found

Symptoms

The following error is displayed:

1
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/xxx/slavespace/slave3/workspace/job_4a1d5be4-b273-4ac8-8d5d-2ee583e71832_1544498089095). Please verify you invoked Maven from the correct directory.

Cause Analysis

The error information shows that the POM file cannot be found. The default build command attempts to find POM in the root directory of the source code. This error indicates that POM is not in the root directory.

For example, the following screenshot shows that POM does not exist in the root directory of the source code. Instead, it is in the server directory.

Solution

Modify the default build command. The following takes the preceding source code structure as an example. Select either one of the following solutions.

  • Run the cd server command to go to the server directory, and then run the mvn command.
  • Add -f ./server/pom.xml to the end of the mvn command to specify the path of POM.