解决Plugin org.apache.maven.pluginsmaven-archetype-pluginRELEASE or one of its dependencies

解决Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved的问题

最近在学习JAvaWeb,在第一次使用IDEA(以前没用过)创建maven项目时,老是创建不成功,文件残缺,下面是错误提示。

[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.282 s
[INFO] Finished at: 2019-01-05T18:29:17+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (E:apache-maven-3.6.0
epository) -> [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/PluginResolutionException
[ERROR] Maven execution terminated abnormally (exit code 1)

这个错误着实让我头疼,在网上找了大量的解决办法一直不奏效,最后自己慢慢摸索出来了一个解决办法,原理不是很明确,但是确实解决了我这个问题,所以记录下来与大家分享,希望能帮助有需要的人。

一、
首先打开maven解压目录下的conf文件夹里的setting.xml,在其中添加如下仓库位置和插件下载url(因为默认的是在国外,在这里我们改成阿里云的国内镜像)

<localRepository>E:apache-maven-3.6.0
epository</localRepository>

这个仓库路径是你自己选的,需要存在这个路径(我是直接在maven的解压文件夹里创建了一个repository)
在这里插入图片描述

<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>       
    </mirror> 

添加阿里云的国内镜像地址。
在这里插入图片描述
保存之后退出。
二、
在IDEA中依次按照路径file-setting找到maven配置选项(如下图),将如下两项修改:第一项修改为maven解压目录下的conf文件夹里的setting.xml,第二项会自动读取setting.xml文件里的仓库地址(如果未自动读取,检查下自己是否写错了),也可以手动更改。更改完成之后点击Apply-OK。
在这里插入图片描述
之后重启IDEA,新建maven项目,就可以发现上面的错误不见啦。
在这里插入图片描述
可以开心地跟IDEA玩耍啦~~~
如果有问题欢迎与我交流。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值