我面临以下例外情况:
org.apache.maven.lifecycle.missingprojectexception:指定的目标需要执行项目,但此目录中没有POM(C:)。请验证您从正确的目录调用了maven。
控制台日志:

[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版本信息:
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"

我需要自己设置pom.xml吗?如何以及在哪里?我是否在windows中正确安装了maven?

最佳答案

查找maven版本的命令是

mvn -X -version

不过-X是一个调试选项,在这里是多余的。
如果你想执行一个项目。
我需要自己设置pom.xml吗?如何以及在哪里?
在顶层目录中基于maven的项目中创建pom.xml。在这里,first maven project sample 将帮助你更进一步。

08-27 22:28
查看更多