原创经验分享(10)Could not transfer artifact org.apache.maven:maven. from/to central. Received fatal aler(代

Posted Thinking in BigData

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了原创经验分享(10)Could not transfer artifact org.apache.maven:maven. from/to central. Received fatal aler(代相关的知识,希望对你有一定的参考价值。

maven编译工程报错

[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:add-source (scala-compile-first) on project trade: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.2.2:add-source failed: Plugin net.alchim31.maven:scala-maven-plugin:3.2.2 or one of its dependencies could not be resolved: Failed to collect dependencies at net.alchim31.maven:scala-maven-plugin:jar:3.2.2 -> org.apache.maven:maven-core:jar:3.0.4 -> org.apache.maven:maven-model:jar:3.0.4: Failed to read artifact descriptor for org.apache.maven:maven-model:jar:3.0.4: Could not transfer artifact org.apache.maven:maven-model:pom:3.0.4 from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [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

但是手工通过浏览器访问maven仓库一切正常

手工下载放到本地repository,然后再编译,这个错没了,又报下一个错,这么多包一个一个手工下载实在伤不起,

wtf,仔细一看,报错还有一句:Received fatal alert: protocol_version

原来是因为这个,官网地址:https://central.sonatype.org/articles/2018/May/04/discontinued-support-for-tlsv11-and-below/ 

这里粘贴一下answer:

If you are using http to access Central, or Java 8+ with https urls, you are not affected.

If you are on Java 7, it supports TLS 1.2 but it is disabled by default in versions before 1.7.0_131-b31, and the following Apache Maven workaround functions for older Java 7 users:

mvn -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 <goals>

or add the following to your environment or build script:

export MAVEN_OPTS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2

If you are on Java 6, you will need to switch back to http or upgrade to a more modern Java version. Very recent versions of Java 6 claim to have TLS 1.2 support, but we have not confirmed it yet. 

原来是因为maven中央仓库不再支持TLSv1.1导致,jdk改为1.8问题解决。

 

以上是关于原创经验分享(10)Could not transfer artifact org.apache.maven:maven. from/to central. Received fatal aler(代的主要内容,如果未能解决你的问题,请参考以下文章

[vscode][原创]pyqt5配置后报错:qt.qpa.plugin: Could not find the Qt platform plugin “windows“ in ““

关于 CMake编译出出现错误“Could not find compiler set in environment variable RC:” 的解决方法

分享知识-快乐自己:intellij Idea报错Could not autowire. No beans of...

原创经验分享(15)spark sql limit实现原理

Could not open Selected VM debug port (8700) (转)

源码追踪,解决Could not locate executable nullinwinutils.exe in the Hadoop binaries.问题