添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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

Received fatal alert: protocol_version
Received fatal alert: peer not authenticated

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 or above instead

Configure $JAVA_HOME to point to Java 8.

Sonatype FAQ about the issue

Discontinued support for TLSv1.1 and below

Can you tell me please what's the equivalent in SBT I tried sbt -Dhttps.protocols=TLSv1.2 instalbut it does not work – G.Saleh Jul 5, 2020 at 22:18 @G.Saleh You need the way to pass this parameter to java -Dhttps.protocols=TLSv1.2. So you need to find how to pass java parameters in SBT. – v.ladynev Jul 6, 2020 at 14:32

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

The link in the blog.sonatype.com article is throwing 404. It is because they updated the link to central.sonatype.org/articles/2018/May/04/…. – Blueboye Jul 9, 2018 at 16:36 after setting this all http download is working for me. however https has issue as below Failed to collect dependencies at org.netpreserve.commons:webarchive-commons:jar:1.1.2 -> org.apache.hadoop:hadoop-core:jar:0.20.2-cdh3u4: Failed to read artifact descriptor for org.apache.hadoop:hadoop-core:jar:0.20.2-cdh3u4: Could not transfer artifact org.apache.hadoop:hadoop-core:pom:0.20.2-cdh3u4 from/to cloudera (repository.cloudera.com/artifactory/cloudera-repos): Received fatal alert: handshake_failure any help – Karn_way Feb 1, 2019 at 11:52

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:

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

I am getting this Failed to collect dependencies at org.netpreserve.commons:webarchive-commons:jar:1.1.2 -> org.apache.hadoop:hadoop-core:jar:0.20.2-cdh3u4: Failed to read artifact descriptor for org.apache.hadoop:hadoop-core:jar:0.20.2-cdh3u4: Could not transfer artifact org.apache.hadoop:hadoop-core:pom:0.20.2-cdh3u4 from/to cloudera (repository.cloudera.com/artifactory/cloudera-repos): Received fatal alert: handshake_failure looks https download has issue . please help I am using java1.7_80 and maven 3.6 – Karn_way Feb 1, 2019 at 11:51 This worked wonders for me. As a user of MyEclipse, all I had to do was to change the JRE for the maven run configuration to 1.8 and then back again to 1.7 after maven had downloaded what it needed. – Thor Hovden Mar 27, 2019 at 11:19

Note that if you're using the IBM JDK you may also have to set

com.ibm.jsse2.overrideDefaultTLS=true

https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jsse2Docs/matchsslcontext_tls.html#matchsslcontext_tls

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.