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

本文介绍用Maven3新建项目时出现错误的情况。可能原因包括Java HOME和Maven HOME设置不正确、使用Maven2命令等。给出的解决方法有检查环境变量设置、删除特定插件、替换过期命令、更换插件版本等,最终通过升级命令解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用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

 

转载于:https://www.cnblogs.com/EasonJim/p/6291622.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值