Eclipse Maven 错误:Received fatal alert: protocol_version -> [Help 1]

1.错误发生的场景:eclipse 项目运行 maven install ,报错了

2.错误的主要描述: Failed to execute goal org.apache.maven.plugins:maven-install-plugin:
2.4:install (default-install) on project TENDJ:
 Execution default-install of goal org.apache.maven.plugins:maven-install-plugin:2.4:
install failed: Plugin org.apache.maven.plugins:maven-install-plugin:
2.4 or one of its dependencies could not be resolved:
 Failed to collect dependencies at org.apache.maven.plugins:maven-install-plugin:jar:2.4 ->
 org.codehaus.plexus:plexus-utils:jar:3.0.5: Failed to read artifact descriptor for org.codehaus.plexus:plexus-utils:jar:3.0.5:
 Could not transfer artifact org.codehaus.plexus:plexus-utils:pom:3.0.5 from/to central (https://repo.maven.apache.org/maven2):
 Received fatal alert: protocol_version -> [Help 1]

3.根据翻译来说,主要是最后面这个问题,protocol_version  也就是协议版本的错误,于是上网查找到了对应的原因    maven Sonatype 中央仓库目前不再支持 TLSv1.1 以及以下的协议版本,通过chrome security 面板看到, 我自己使用的maven 中央仓库已经是  TLSv1.2 协议了

4.解决办法:

4.1.使用http去访问maven中央仓库(适用于对安全不严格的场景),修改setting.xml文件

<profiles>          
    <profile>  
        <id>maven-home</id>  
        <repositories>  
            <repository>  
                <id>central</id>  
                <url>https://repo1.maven.org/maven2</url>  
                <releases>  
                    <enabled>true</enabled>  
                    <checksumPolicy>warn</checksumPolicy>  
                </releases>  
                <snapshots>  
                    <enabled>false</enabled>  
                </snapshots>  
            </repository>  
        </repositories>  
  
    <pluginRepositories>  
        <pluginRepository>  
            <id>central</id>              
            <url>http://repo1.maven.org/maven2</url>              
            </pluginRepository>  
    </pluginRepositories>  
</profile>  

4.2.升级jdk到1.8

4.3.通过添加 -Dhttps.protocols=TLSv1.2 , 配置 java runtime 参数,来 enable TLS 1.2

我用的就是第三种方法:

找到eclipse的jdk配置环境,在"Default VM arguments"这一栏填入:-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2

 

参考文章:

https://feitianbenyue.iteye.com/blog/2429045

https://www.cnblogs.com/leite/p/9865961.html

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值