maven: 解决 release to oss.sonatype.org 报错:SSL peer shut down incorrectly

向右看齐 2023-02-15 12:48 398阅读 0赞

今天执行mvn release:perform发布项目jar包到maven中央仓库时报了如下错误导致发布失败:

Remote host terminated the handshake
SSL peer shut down incorrectly

  1. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project common-base: Failed to deploy metadata: Could not transfer metadata com.gitee.l0km:common-base/maven-metadata.xml from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Remote host closed connection during handshake: SSL peer shut down incorrectly -> [Help 1]
  2. [ERROR]
  3. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  4. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  5. [ERROR]
  6. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  7. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  8. [ERROR]
  9. [ERROR] After correcting the problems, you can resume the build with the command
  10. [ERROR] mvn <goals> -rf :common-base

出现这个情况并是必然的,目前没有找到规律,好像发布比较大的jar出现的概率就大一些。有时失败后重新执行一遍又能正常通过。所以就没在意,但是今天发布一个超过100MB的jar包时,执行了5,6次都报如上的错误就不能忍了。
google上搜索了一相关的主题,发现好像是ssl的问题:

比如这个mave官方的说明:
https://issues.sonatype.org/browse/NEXUS-7659
在这里插入图片描述
再比如这个stackoverflow上的帖子给出了解决方案,如下图:
https://stackoverflow.com/questions/50328668/maven-java-build-ssl-peer-shut-down-incorrectly

在这里插入图片描述
对你没看错, 上图红框圈出来的就是解决方案,如下执行release就可以了:

  1. mvn release:perform -Dhttps.protocols=TLSv1.2

经实测,如果发布版本时遇到SSL peer shut down incorrectly的问题,就上加-Dhttps.protocols=TLSv1.2参数再执行一次,应该就可以成功发布了。

发表评论

表情:
评论列表 (有 0 条评论,398人围观)

还没有评论,来说两句吧...

相关阅读