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

When building/initializing a Maven project, the following situation may occur:

[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

reason:

A specified goal is missing, and a goal data needs to be added to the project's pom.xml file.

Solution:

Find lib/model-builder-3.6.0.jar in the installation directory and choose to use the compressed package to open it.

Find pom.xml according to this directory META-INF——maven——org. apache .maven——maven-model-builder

Then find the first build and add the first line in it:<defaultGoal>compile</defaultGoal>

<build>
	<defaultGoal>compile</defaultGoal>
</build>

Guess you like

Origin blog.csdn.net/weixin_46474921/article/details/133706412