Maven错误“Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create ”解决

Posted Jim

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 

以上是关于Maven错误“Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create ”解决的主要内容,如果未能解决你的问题,请参考以下文章

Idea创建Maven项目时出现Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1错误

maven打包工程出现错误 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(示例代码

thingsboard编译错误 Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (npm instal

maven打包错误: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources(代码

解决Maven打包怪异异常:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin

maven install时报错 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (