Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1]

Tags:

java

maven

I am new to Maven and trying to setup my first project in Maven but receiving the below error message when I am doing " Run as -> Maven install " in Eclipse. Below is my settings.xml and pom.xml

Settings.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> 

Error message:

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 

How to resolve the Received fatal alert: protocol_version ? My java version is 1.7 and maven version is 3.3.3

like image 521
SimbuStar Avatar asked Jun 20 '18 10:06

SimbuStar


People also ask

Could not transfer artifact from to Nexus releases?

This is authorization issue. Open settings. xml file from folder where maven is installed and correct the user ID and password. It should solve your problem.

What is Apache Maven repository?

A repository in Maven holds build artifacts and dependencies of varying types. There are exactly two types of repositories: local and remote: the local repository is a directory on the computer where Maven runs. It caches remote downloads and contains temporary build artifacts that you have not yet released.

Is Maven an artifact?

In Maven terminology, an artifact is an output generated after a Maven project build. It can be, for example, a jar, war, or any other executable file. Also, Maven artifacts include five key elements, groupId, artifactId, version, packaging, and classifier.


2 Answers

Sonatype no longer supports TLSv1.1 and below (effective, June 18th, 2018). My guess is that you are using TLSv1.1 protocol or below.

The documentation I listed gives you 4 options:

  1. Upgrade your Java runtime, for example with OpenJDK builds or Oracle paying support
  2. Configure your Java runtime to enable TLS 1.2 by adding -Dhttps.protocols=TLSv1.2
  3. Use a repository manager that uses a Java version supporting TLS 1.2
  4. Revert back to http until you can acheive one of the above remediation steps.

I fixed it myself by just using -Dhttps.protocols=TLSv1.2 as a VM argument.  

like image 158
Eric Avatar answered Sep 19 '22 13:09

Eric


For a permanent solution(mostly required in Java 7) - in you build directory(where you do the mvn command from) add directory:

.mvn (in cmd mkdir .mvn)

and in it create file

jvm.config

and in put the following line:

-Dhttps.protocols=TLSv1.2

like image 31
Yoav R. Avatar answered Sep 20 '22 13:09

Yoav R.