Why am I getting "Received fatal alert: protocol_version" or "peer not authenticated" from Maven Central?

MavenMaven Central

Maven Problem Overview


I'm getting the below errors when connecting to Maven Central / https://repo1.maven.org after June 18th 2018.

Received fatal alert: protocol_version

or

Received fatal alert: peer not authenticated

Maven Solutions


Solution 1 - Maven

Solution 1: configure Java 7

It is need to enable TLS 1.2 protocol with Java property in the command line

mvn -Dhttps.protocols=TLSv1.2 install

install is just an example of a goal

The same error for ant can be solved by this way

java -Dhttps.protocols=TLSv1.2 -cp %ANT_HOME%/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher

Solution 2: use Java 7 with Oracle Advanced Support

Also problem can be solved by updating the Java 7 version. But the last available version (7u80) doesn't fix the problem. It is need to use an update provided with Oracle Advanced Support (formerly known as Java for Business).

Solution 3: use Java 8 instead

Configure $JAVA_HOME to point to Java 8.

Solution 2 - Maven

In June 2018, in an effort to raise security and comply with modern standards, the insecure TLS 1.0 & 1.1 protocols will no longer be supported for SSL connections to Central. This should only affect users of Java 6 (and Java 7) that are also using https to access central, which by our metrics is less than .2% of users.

For more details and workarounds, see the blog and faq here: https://blog.sonatype.com/enhancing-ssl-security-and-http/2-support-for-central

Solution 3 - Maven

The following command helped me (executing on bash before running mvn)

export MAVEN_OPTS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2

Solution 4 - Maven

As said @v.ladynev, it works with JDK 1.7

With Eclipse, to be able to perform a "Run As" maven install with the TLS command-line parameter, just configure the JDK you're using.

Open the dialog through Window > Preferences > Java > Installed JREs.

Then highlight the one you're using (should be a JDK, not a JRE), click on Edit. In the field "Default VM arguments", fill the value -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2. As shown below:

enter image description here

Clean the project (maybe optional), then re-run a maven install.

Solution 5 - Maven

I'm sorry, I don't know why you get the error message. However, I'm using Java 7 and Windows 10 and the solution for me was to temporarily use Java 8 by changing the JAVA_HOME environment variable. Then I could run mvn install and fetch from Maven Central Repository.

Solution 6 - Maven

Update maven version to 3.6.3 and run

mvn -Dhttps.protocols=TLSv1.2 install

it worked on centos 6.9

Solution 7 - Maven

Solution 8 - Maven

Add "-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2" to "Default VM arguments" under Window -> Preferences -> Java -> Installed JREs in Eclipse, validate and run your project, it should and will work.

Solution 9 - Maven

Using jdk7-u221, I was need to install the Java Cryptography Extension (JCE)

Java Cryptography Extension JCE

Solution 10 - Maven

For setting java properties on Windows app server:

  • configure tomcat > run as admin
  • then add Java opts:
  • restart service.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBrian FoxView Question on Stackoverflow
Solution 1 - Mavenv.ladynevView Answer on Stackoverflow
Solution 2 - MavenBrian FoxView Answer on Stackoverflow
Solution 3 - MavenSimon_Prewo_FrankfurtView Answer on Stackoverflow
Solution 4 - MavenAmessihelView Answer on Stackoverflow
Solution 5 - MavenpropatienceView Answer on Stackoverflow
Solution 6 - MavenicaglarView Answer on Stackoverflow
Solution 7 - MavenEdoardo ComarView Answer on Stackoverflow
Solution 8 - MavensbareddView Answer on Stackoverflow
Solution 9 - MavenjosuedaniView Answer on Stackoverflow
Solution 10 - MavenDon JulioView Answer on Stackoverflow