栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

mvn test BUILD FAILURE

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

mvn test BUILD FAILURE

具体报错是这样的

mvn test [22:04:05]
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.200 s
[INFO] Finished at: 2021-10-02T14:04:16Z
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/project). 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

解决方案如下:

This error indicates that you tried to execute a goal which requires a POM but Maven didn't find a pom.xml file in the directory you invoked it from. In most cases, fixing this is merely a matter of changing the current directory in the command prompt to point at your project's base directory. If you don't want to change the current directory, you have to tell Maven explicitly where the POM to build resides like this:

mvn -f path/to/pom.xml ...

报错的原因是,maven 测试的位置不对,找不到pom.xml,这个错误表明试图执行一个需要pom.xml的目标,但是Maven在调用它的目录中没有找到pom.xml文件。

在大多数情况下,解决这个问题只需在命令提示符中更改当前目录,以指向项目的基本目录。如果你不想改变当前目录,你必须像这样明确地告诉Maven要构建的POM驻留在哪里,或者也可以直接进入pom.xml所在地的目录下进行maven测试。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/287130.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号