您现在的位置是:首页 > 技术教程 正文

Maven启动报错 - No goals have been specified for this build.You must specify a valid lifecycle phase

admin 阅读: 2024-03-18
后台-插件-广告管理-内容页头部广告(手机)

在对Maven项目进行Build / 初始化时  可能会出现下图这种情况:

  1. [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]
  2. [ERROR]
  3. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  4. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  5. [ERROR]
  6. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  7. [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,在里面第一行添加:compile

  1. <build>
  2. <defaultGoal>compile</defaultGoal>
  3. </build>

标签:
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

在线投稿:投稿 站长QQ:1888636

后台-插件-广告管理-内容页尾部广告(手机)
关注我们

扫一扫关注我们,了解最新精彩内容

搜索