Mavenを使用するときに発生するエラーと解決策

1.
プロジェクトの作成時に、mavenコマンドライン(mvn archetype:create -DgroupId = xx DartifactId = simple -DpackageName = xx)を使用すると、次のエラーが報告されます。

[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

理由は次のとおり
です。maven3.0.5 以前のバージョンは作成のみをサポートし、3.0.5以降のバージョンは生成を使用する必要があります。これは次のコマンドです。mvn archetype:generate -DgroupId = xx DartifactId = simple -DpackageName = xx

2.上記の問題が解決された後、次のエラーが再度報告されます

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

その理由は、現在のプロジェクトを作成したディレクトリにpomファイルが既に存在するため、競合が発生しているため、現在のディレクトリにあるpomファイルを削除するだけで問題ありません。

190件の元の記事を公開 19件の賞賛 200,000回以上の閲覧

おすすめ

転載: blog.csdn.net/zengchenacmer/article/details/58376148