今天把一个去年没做完的项目翻出来做时,发现maven无法正常导入依赖。检查了一遍项目配置,没发现有什么问题。而且依赖在本地仓库存在。

随后发现报错:Failed to transfer file:*********. Return code is: 501 , ReasonPhrase:HTTPS Required. 这时候好像发现了什么重点————我们需要将maven配置修改一下:

        <!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>https://repo1.maven.org/maven2/</url>
</mirror> <!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>https://repo2.maven.org/maven2/</url>
</mirror>

随后发现可以正常导入依赖了。

在stackoverflow上查了下,发现有人也遇到了这个问题:

Recently Maven build jobs running in Jenkins are failing with the below exception saying that they could not pull dependencies from Maven Central and should use HTTPS. I am not sure how to change the requests from HTTP to HTTPS. Could someone guide me on this matter?

回答如下:

Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.

所以这个问题的根源就是maven中央仓库现在只支持HTTPS协议,我们改一下就行。

最新文章

  1. Xcode同一个Workspace中两个工程依赖于Undefined Symbol Error
  2. 函数式 js 接口实现原理,以及 lodash/fp 模块
  3. Map工具系列-03-代码生成BySQl工具使用说明
  4. NuGet打包推送批处理以及MSBuild(通用版)
  5. RMQ_ST算法
  6. C#序列化JSON
  7. 《Algorithms算法》笔记:优先队列(2)——二叉堆
  8. apache配置weblogic部署集群,多节点的项目和单节点项目并存 负载均衡
  9. [Flex] Accordion系列 - Header图标的设置
  10. shell for循环+case的脚本(监控程序状态)
  11. java多线程编程(2)交替输出数字和字母
  12. ThinkPHP框架下基于RBAC的权限控制模式详解
  13. Tomcat禁止外网访问
  14. C++输出九九乘法表
  15. SQLServer之创建全文索引
  16. fpga xilink 电平
  17. 基于Senparc.CO2NET 缓存策略扩展的缓存使用方法
  18. ACM-ICPC 2018 南京赛区网络预赛B
  19. angularjs的config和interceptor - session注入
  20. 通过POST请求上传文件

热门文章

  1. 使用cnpm i -S axios 遇到报错Install fail! Error: EISDIR: illegal operation on a directory, symlink..........的解决办法
  2. ES6必须 知道的小知识
  3. POJ - 3415 Common Substrings (后缀数组)
  4. IntPtr、Struct 相互转换
  5. HBase的安装及使用
  6. 【Linux】grep笔记
  7. JMeter录制登录测试
  8. Vue+Element实现网页版个人简历系统
  9. JavaScript | 值传递、引用传递的区别
  10. $bzoj3872\ [Poi2014]\ Ant\ colony$ 二分+$dp$