javawindowsmaven

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


I'm facing below exception:

org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (C:). Please verify you invoked Maven from the correct directory.

Console log:

[DEBUG] Reading global settings from C:\Program Files\apache-maven-3.2.5\conf\settings.xml 
[DEBUG] Reading user settings from C:\Users\user_aaa\.m2\settings.xml 
[DEBUG] Using local repository at C:\path\to\local\repo 
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\path\to\local\repo 
[INFO] Scanning for projects... 
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none) 
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.078 s 
[INFO] Finished at: 2017-09-12T17:05:08+08:00 
[INFO] Final Memory: 5M/123M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\). Please verify you invoked Maven from the correct directory. -> [Help 1] org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (C:\). Please verify you invoked Maven from the correct directory.

Maven version info:

C:\>mvn -X version 
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00) 
Maven home: C:\Program Files\apache-maven-3.2.5 
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_144\jre 
Default locale: en_US, platform encoding: MS950_HKSCS
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"

Do I need to set pom.xml by myself? How and where? Did I install Maven correctly in Windows?


Solution

  • The command to find the version of maven is

    mvn -X -version 
    

    though -X is a debug option and is redundant here.

    In case you want to execute a project.

    do I need to set pom.xml by myself? How and where?

    You create a pom.xml within a maven based project at the top level directory. The first maven project sample shall help you further here.