Maven錯誤「Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create 」解決

用maven3新建一個項目時,輸入的命令以下:apache

mvn archetype:create

出現錯誤以下:maven

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of mojo org.apache.maven.plugins:maven-archetype-plugin:2.4:create for parameter #: Cannot create instance of interface org.apache.maven.artifact.repository.ArtifactRepository: org.apache.maven.artifact.repository.ArtifactRepository.<init>() -> [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/PluginConfigurationException

可能存在的緣由:好比Java HOME設置不正確,Maven HOME設置不正確,在Maven3使用Maven2的命令。spa

解決方法:插件

* JAVA_HOME沒有設置或者設置有誤、m2_home設置有誤debug

* 刪除/org/apache/maven/plugins/下的maven-archetype-plugincode

* archetype:create命令已通過期,須要使用 archetype:generate 來進行代替(方案可行)orm

* maven-archetype-plugin 2.3版本的插件有問題,換其它版本進行建立(方案可行)blog

最終我直接升級了命令,問題解決:it

mvn archetype:generate
相關文章
相關標籤/搜索