java - 无法传输工件(https://repo.maven.apache.org/maven2):收到致命警报:protocol_version -> [帮助 1]
问题描述
我是 Maven 新手并尝试在 Maven 中设置我的第一个项目,但是当我在 Eclipse 中执行“Run as -> Maven install”时收到以下错误消息。下面是我的 settings.xml 和 pom.xml
设置.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\Iam\.m2\repository</localRepository>
<profiles>
<profile>
<repositories>
<repository>
<id>central</id>
<url>http://central.maven.org/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
</pluginRepositories>
</profile>
</profiles>
</settings>
POM.XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mytest</groupId>
<artifactId>MySpringBootMaven</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.11.RELEASE</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version><!--$NO-MVN-MAN-VER$-->
<configuration>
<warnName>Test.war</warnName>
</configuration>
</plugin>
</plugins>
</build>
</project>
错误信息:
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.11.RELEASE
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
... 27 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.11.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
... 30 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.11.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
如何解决收到的致命警报:protocol_version?我的 java 版本是 1.7,maven 版本是 3.3.3
解决方案
Sonatype不再支持 TLSv1.1 及更低版本(2018 年 6 月 18 日生效)。我的猜测是您使用的是 TLSv1.1 协议或更低版本。
我列出的文档为您提供了 4 个选项:
- 升级您的 Java 运行时,例如使用 OpenJDK 构建或 Oracle 付费支持
- 通过添加 -Dhttps.protocols=TLSv1.2 配置您的 Java 运行时以启用 TLS 1.2
- 使用使用支持 TLS 1.2 的 Java 版本的存储库管理器
- 恢复到 http,直到您可以完成上述修复步骤之一。
我自己通过使用 -Dhttps.protocols=TLSv1.2 作为 VM 参数来修复它。
推荐阅读
- python - 字符串显示相同的内容,但程序说它们是不同的字符串
- angular - 使用 xAuthToken 、 spring redis 和 security 登录应用程序
- ruby - 无法收集分页
- python - 如何安排 Cron 以不同的时间间隔运行 Python 脚本
- java - LOGBACK - 根据大小滚动文件,然后在一天结束时将所有文件一起滚动到压缩文件夹中
- godot - 无效的获取索引“get”(基于:“RigidBody2D (bird.gd)”)错误
- laravel - 无法在自定义服务中获取请求数据?
- javascript - 添加不重新定位页面的关闭功能
- java - Java 复制 ArrayList 值未参考
- laravel - Connect GIATA hotel mapping with postman