Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Received fatal alert: protocol_version build failure Gradle/Maven

One of my project's build started failing with the exception given below

   > Could not resolve org.slf4j:slf4j-api:[1.6.1,).
  > Failed to list versions for org.slf4j:slf4j-api.
     > Unable to load Maven meta-data from https://repo1.maven.org/maven2/org/slf4j/slf4j-api/maven-metadata.xml.
        > Could not GET 'https://repo1.maven.org/maven2/org/slf4j/slf4j-api/maven-metadata.xml'.
           > Received fatal alert: protocol_version

Environment:

  • Java 7
  • Gradle 3.5
like image 771
Atul Avatar asked Jun 28 '18 20:06

Atul


1 Answers

Maven Central and Bintray have announced that they will discontinue support for TLS v1.1 and below. You will be affected if you are using Java 6 or 7 and using Gradle versions 2.1 through 4.8.

GRADLE:

Check gradle version

gradle --version

You must take action if all of these are true:

  • JVM version is Java 7u130 or lower and
  • Gradle version is between 2.1 and 4.8, inclusive
  • and you have declared a repository {} of mavenCentral() or jcenter()

You can take any one of the following actions to use TLS v1.2+:

  • Run Gradle with Java 1.7.0_131-b31 or above
  • or upgrade to Gradle 4.8.1 or above
  • or replace mavenCentral() with maven { url = "http://repo.maven.apache.org/maven2" } and jcenter() with maven { url = "http://jcenter.bintray.com" }

The first two solutions are recommended, as the third opens a possible attack vector.

Source:https://blog.gradle.org

Maven:

If you are using Maven use the command given below

mvn -Dhttps.protocols=TLSv1.2 install
like image 171
Atul Avatar answered Oct 11 '22 12:10

Atul