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

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

Remote host terminated the handshake
SSL peer shut down incorrectly

    [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]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [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就可以了:

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

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

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

10km

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值