Search code examples
javamavengradlejava-8java-7

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

Solution

  • 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+:

    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