maven报错的解决:[ERROR] No goals have been specified for this build. ...

在项目目录执行mvn -e,发现报错:

[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: 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-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: 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: 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-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:97)

解决步骤:

  1. 检查数据库服务是否开启
  2. 检查数据库是否完整
  3. 在pom.xml配置增加defaultGoal,代码如下:
<build>
	<defaultGoal>compile</defaultGoal>
</build>
maven报错的解决:[ERROR] No goals have been specified for this build. ...maven报错的解决:[ERROR] No goals have been specified for this build. ... 云淡风轻笑忘书 发布了26 篇原创文章 · 获赞 7 · 访问量 6万+ 私信 关注
上一篇:解决Idea的Generate Sources无法生成QueryDSL问题


下一篇:Lc22-Generate Parentheses