[ERROR] No goals have been specified for this build. You must specify a vali@TOC
完整报错
No goals have been specified for this build. You must specify a valid
lifecycle phase or a goal in the format : or
:[:]:.
Available lifecycle phases are: pre-clean, clean, post-clean,
validate, initialize, generate-sources, process-sources,
generate-resources, process-resources, compile, process-classes,
generate-test-sources, process-test-sources, generate-test-resources,
process-test-resources, test-compile, process-test-classes, test,
prepare-package, package, pre-integration-test, integration-test,
post-integration-test, verify, install, deploy, pre-site, site,
post-site, site-deploy. -> [Help 1] [ERROR]
在排除jdk和maven都配置正确的前提下,运行项目总是报以上错误,困扰了我大半天,经反复确认其他各项配置没有出错:
1.jdk,maven安装正确
2.导入的当前项目所用的jdk和maven版本都和本地对得上
以上检查都无误,网上搜索这个错误的解决方案,我发现主要有两个:
1.在对应项目的pom文件中添加
<build>
<defaultGoal>compile</defaultGoal>
</build>
2.在maven的pom文件中添加
<build>
<defaultGoal>compile</defaultGoal>
</build>
以上两种方法都没有效果,算是卡在这里了。。。
Getchat是这样说的:
后面我突发奇想,把该项目删除了,重新解压了一次,然后把项目路径从中文路径换到了英文路径,放上就跑通了!!!猜测原因是放中文路径导致的错误,所以以后要避免这样的基本错误犯!