When using maven, errors encountered and solutions

1. Use the maven command line (mvn archetype: create -DgroupId = xx DartifactId = simple -DpackageName = xx), when
creating a project, the following error has been reported:

[ERROR] Could not find goal 'create' in plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.0 among available goals crawl, create-from-project, generate, help, integration-test, jar, update-local-catalog -> [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/MojoNotFoundException

The reason is: maven 3.0.5 and earlier versions only support create, and versions after 3.0.5 should use generate, which is the following command:
mvn archetype: generate -DgroupId = xx DartifactId = simple -DpackageName = xx

2. After the above problem is solved, the following error is reported again

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate (default-cli) on project StudySpark: Unable to add module to the current project as it is not of packaging type 'pom' -> [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/MojoFailureException

The reason is: There is already a pom file in the directory where you created the current project, resulting in a conflict. Just delete the pom file in the current directory and it will be ok.

Published 190 original articles · 19 praises · 200,000+ views

Guess you like

Origin blog.csdn.net/zengchenacmer/article/details/58376148