在使用指令创建maven项目,编译时遇到一个小问题如下:
E:\work\webadv\repo>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.070 s
[INFO] Finished at: 2020-04-14T17:44:01+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (E:\work\webadv\repo). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
错误信息:您指定的目标需要一个项目来执行,但此目录中没有POM(E:\ work\webadv\repo)。请验证您是从正确的目录调用了Maven。
实际上,在创建时(E:\work\webadv\repo是我创建项目的目录),我们创建了一个工程项目(这里工程项目名叫做p02),即多了一层目录,打开这层目录再编译即可
打开repo文件
p02(即工程项目)文件夹才包含pom文件
E:\work\webadv\repo>cd p02
E:\work\webadv\repo\p02>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< webadv.s******.p02:p02 >----------------------
[INFO] Building p02 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
ok 编译成功!!! so easy