Maven 构建失败——DependencyResolutionException [英] Maven Build Failure -- DependencyResolutionException

查看:551
本文介绍了Maven 构建失败——DependencyResolutionException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在安装一个具有 Maven 依赖项的包,并在我尝试清理它时收到 DependencyResolutionException.克隆它后,我导航到该目录并运行以下命令安装它,没有错误:

I'm installing a package that has Maven dependency and get a DependencyResolutionException when I try to clean it. After cloning it, I navigate to the directory and run the following to install it with no error:

mvn install:install-file -Dfile=./lib/massbank.jar -DgroupId=massbank  -DartifactId=massbank -Dversion=1.0 -Dpackaging=jar
mvn install:install-file -Dfile=./lib/metfusion.jar -DgroupId=de.ipbhalle.msbi  -DartifactId=metfusion -Dversion=1.0 -Dpackaging=jar

那么:

mvn clean package 

具有以下控制台输出:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< MassBank2NIST:MassBank2NIST >---------------------
[INFO] Building MassBank2NIST 0.0.2-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.450 s
[INFO] Finished at: 2021-04-07T01:08:28-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MassBank2NIST: Could not resolve dependencies for project MassBank2NIST:MassBank2NIST:jar:0.0.2-SNAPSHOT: Failed to collect dependencies at edu.ucdavis.fiehnlab.splash:core:jar:1.8: Failed to read artifact descriptor for edu.ucdavis.fiehnlab.splash:core:jar:1.8: Could not transfer artifact edu.ucdavis.fiehnlab.splash:core:pom:1.8 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [EBI (http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/, default, releases+snapshots), releases (http://gose.fiehnlab.ucdavis.edu:55000/content/groups/public, default, releases+snapshots)] -> [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/DependencyResolutionException

如有必要,我可以发布调试日志开关的输出,但它很长.我也可以发布 pom.xml,但它根据我所知道的要求引用了存储库.

I can post the output of the debug logging switch if necessary, but it's quite long. I can also post the pom.xml, however it refers to the repositories as required from what I can tell.

我搜索过类似的帖子,但似乎没有一个包含相同系列或类似的错误.有人可以帮我解读这些错误吗?

I've searched for similar posts, but none seem to contain the same series of errors or similar. Can someone help me decipher these errors?

谢谢!

推荐答案

您不必降级 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>

这篇关于Maven 构建失败——DependencyResolutionException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆