2018-12-06

eClipse Photon- Run As: maven install hit "Error: Could not find or load main class TLSv1.2"








Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version



JDK 7 issues from https://feitianbenyue.iteye.com/blog/2429045:

由于我的同事, 使用的 jdk 是 1.7 , jdk1.7虽然支持TLS 1.2 但是默认是 disabled的, 所以就会出现上面的 Received fatal alert: protocol_version  异常

下表格是 根据Oracle文档 各版本JDK默认使用的TLS协议:

JDK 8
(March 2014 to present)
JDK 7
(July 2011 to present)
JDK 6
(2006 to end of 2013)
TLS ProtocolsTLSv1.2 (default)
TLSv1.1
TLSv1
SSLv3
TLSv1.2
TLSv1.1
TLSv1 (default)
SSLv3

TLS v1.1 (JDK 6 update 111+)
TLSv1 (default)
SSLv3
Resolve by using
3. 解决方案
3.1 方案1 :   使用 http  去访问 maven  中央仓库




In Maven User Settings(settings.xml), assigned xml config below to my profile.

<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>repo.maven.apache.org</id>
<url>https://repo.maven.apache.org/maven2</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>



Reference URL:

  1. https://feitianbenyue.iteye.com/blog/2429045
  2. https://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin
  3. https://stackoverflow.com/questions/14396017/difference-between-repository-and-pluginrepository