在对Maven项目进行Build / 初始化时 可能会出现下图这种情况:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. 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]
[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/NoGoalSpecifiedException
原因:
缺少了一个指定的goal,需要在项目的pom.xml文件中添加一项goal数据。
解决办法:
在安装目录下找到lib/model-builder-3.6.0.jar选择使用压缩包打开
根据这个目录META-INF——maven——org.apache.maven——maven-model-builder找到pom.xml
然后找到第一个build,在里面第一行添加:<defaultGoal>compile</defaultGoal>
文章来源:https://www.toymoban.com/news/detail-738473.html
<build>
<defaultGoal>compile</defaultGoal>
</build>
文章来源地址https://www.toymoban.com/news/detail-738473.html
到了这里,关于Maven启动报错 - No goals have been specified for this build.You must specify a valid lifecycle phase的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!