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


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

mvn archetype:create

出現錯誤如下:

[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的命令。

解決方法:

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

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

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

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

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

mvn archetype:generate

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM