王艳玲 发表于 2017-12-25 10:48:48

Maven错误“Failed to execute goal org.apache.maven.plugins:maven-archetype

  用maven3新建一个项目时,输入的命令如下:
  

mvn archetype:create  

  出现错误如下:
  

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>() ->   

  
To see the full stack
trace of the errors, re-run Maven with the -e switch.  
Re-
run Maven using the -X switch to enable full debug logging.  

  

For more information about the errors and possible solutions, please read the following articles:  
[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  
页: [1]
查看完整版本: Maven错误“Failed to execute goal org.apache.maven.plugins:maven-archetype