• 解决Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE 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)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

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

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

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

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

    <mirror>
          <id>alimaven</id>
          <name>aliyun maven</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>       
        </mirror> 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

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

  • 相关阅读:
    【iCore3 双核心板】例程九:ADC实验——电源监控
    【iCore3 双核心板】例程八:定时器PWM实验——呼吸灯
    【iCore3双核心板】扩展引脚分布
    【iCore3 双核心板】例程七:WWDG看门狗实验——复位ARM
    【iCore3 双核心板】例程六:IWDG看门狗实验——复位ARM
    【iCore3 双核心板】例程五:SYSTICK定时器实验——定时点亮LED
    【iCore3 双核心板】例程四:USART通信实验——通过命令控制LED
    【iCore3 双核心板】例程三:EXTI中断输入实验——读取ARM按键状态
    【iCore3 双核心板】例程二:读取arm按键状态
    【iCore3 双核心板】例程一:ARM驱动三色LED
  • 原文地址:https://www.cnblogs.com/shiyueyangne/p/14240494.html
Copyright © 2020-2023  润新知