今天在做canal的服务开发,引用其client依赖时一直报如下错误:
通过查询发现,自2020年1月15日起,中央存储库不再支持通过纯HTTP进行的不安全通信,并且要求对存储库的所有请求都通过HTTPS进行加密。原文如下:
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.
If you're receiving this error, then you need to replace all URL references to Maven Central with their canonical HTTPS counterparts.
所以在引入外部依赖时需要在settings文件中加入如下配置:
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>https:
//repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
链接参考:https://stackoverflow.com/questions/59763531/maven-dependencies-are-failing-with-501-error