关于Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol

关于Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol

关于Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol

最近突然发现,maven的*仓库下载pom文件失败,报错是Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1],浏览器是能够访问的。

其实就是*仓库必须要TLS1.2版本才能访问,貌似是今年六月份刚改的,所以有两种解决方法

 

第一种方法:将jdk版本升级到jdk1.8,因为在1.8及以上版本,才会默认使用TLS1.2

第二种方法(没有测试过):

maven的setting.xml设置为阿里云私服

<mirrors>

<!-- mirror

| Specifies a repository mirror site to use instead of a given repository. The repository that

| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used

| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.

|

<mirror>

<id>mirrorId</id>

<mirrorOf>repositoryId</mirrorOf>

<name>Human Readable Name for this Mirror.</name>

<url>http://my.repository.com/repo/path</url>

</mirror>

-->

<mirror>

<id>nexus-aliyun</id>

<mirrorOf>*</mirrorOf>

<name>Nexus aliyun</name>

<url>http://maven.aliyun.com/nexus/content/groups/public</url>

</mirror>

</mirrors>

 

注意::方法二 他不会下载到私服 会直接下载到本地