且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven 构建失败——DependencyResolutionException

更新时间:2023-09-17 17:16:52

您不必降级 Maven.这里发生的事情是,从 3.8.1 开始,Maven 带有一个默认配置来阻止所有 HTTP(不安全)存储库.***的方法是升级您的存储库并使其安全 (HTTPS).

You don't have to downgrade Maven. What happens here is that since 3.8.1, Maven comes with a default configuration to block all HTTP (insecure) repositories. The best way would be to upgrade your repositories and make them secure (HTTPS).

但是,您可以通过将此镜像添加到您的 ~/.m2/settings.xml 来告诉 Maven 允许从不安全的存储库下载:

However, you can tell Maven to allow downloading from your insecure repository by adding this mirror to your ~/.m2/settings.xml:

<mirror>
  <id>insecure-repo</id>
  <mirrorOf>external:http:*</mirrorOf>
  <url>http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/</url>
  <blocked>false</blocked>
</mirror>

blocked 设置为 false 将解决您的问题.请注意,上面的代码片段假设 www.ebi.ac.uk 上的存储库反映了所有不安全的 HTTP 存储库(这就是 external:http:* 的意思).

Setting blocked to false will fix your issue. Note that above snippet assumes that the repository at www.ebi.ac.uk mirrors all insecure HTTP repositories (which is what external:http:* means).

您还可以取消阻止单个存储库.例如,JasperSoft 存储库是不安全的,我使用以下命令取消阻止:

You can also unblock individual repositories. For example, the JasperSoft repository is insecure, I unblock it with:

<mirror>
  <id>jaspersoft-third-party-mirror</id>
  <mirrorOf>jaspersoft-third-party</mirrorOf>
  <url>http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/</url>
  <blocked>false</blocked>
</mirror>