关于maven打包时的报错: Return code is: 501 , ReasonPhrase:HTTPS Required

网友投稿 796 2023-04-16

关于maven打包时的报错: Return code is: 501 , ReasonPhrase:HTTPS Required

关于maven打包时的报错: Return code is: 501 , ReasonPhrase:HTTPS Required

今天使用jenkins构建时,报以下错误

[ERROR] Failed to execute goal on project saas20: Could not resolve dependencies for project com.ipower365.saas:saas20:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.ipower365.saas:messageserviceimpl:jar:0.0.1-SNAPSHOT -> com.ipower365.boss:nacha:jar:1.0.1: Failed to read artifact descriptor for com.ipower365.boss:nacha:jar:1.0.1: Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central (http://repo1.maven.org/maven2/):

Failed to transfer file:

http://repo1.maven.org/maven2/com/ipower365/boss/nacha/1.0.1/nacha-1.0.1.pom

. Return code is: 501 , ReasonPhjZyDTniOrase:HTTPS Required. -> [Help 1]

我们发现,这个依赖的文件在本地仓库是有的,但是在构建过程中,在本地nexus-完文件后,还是会像中央仓库请求文件-

[echoing saas20] Downloading from central: http://repo1.maven.org/maven2/com/ipower365/boss/nacha/1.0.1/nacha-1.0.1.pom

之后我们根据返回的501错误,去搜索问题,参考链接如下:

https://stackoverflow.com/questions/59763531/maven-dependencies-are-failing-with-501-error

上面提示,自2020年1月15日起,中央存储库不再支持通过纯HTTP进行的不安全通信,并且要求对存储库的所有请求都通过HTTPS进行加密。

于是我们在构建过程中所依赖的settings文件中,加入了一以下配置:

central

Maven Repository Switchboard

https://repo1.maven.org/maven2/

central

但是问题依然没有解决,接着报错,错误如下:

Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central

 (https://repo1.maven.org/maven2/):

Received fatal alert: protocol_version -> [Help 1]

这个是在使用https协议请求中央仓库时,需要指定协议版本,然后在构建时,加入了如下参数,参考链接如下:

https://stackoverflow.com/questions/50824789/why-am-i-getting-received-fatal-alert-protocol-version-or-peer-not-authentic

然后再次构建时,就通过请求了!

原因:我们java环境用的是7和8两种,而我们的mvn版本用的是3.5.x。

所以,在java8环境使用mvn打包时,不需要指定以上参数,但是使用JAVA7环境的时候,则会出现以上报错。后面会考虑更新下mvn的版本及统一JAVA环境

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:maven deploy时报错的解决方法
下一篇:app 应用软件开发(app应用软件开发多少钱)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~