2

我的公司政策限制我们从公共存储库(maven_central、spring-io 等)下载第三方工件我们使用 Nexus 作为存储库管理器,它托管我们公司政策批准的所有工件。

我们正在尝试在我们的项目中使用 io-platform bom pom 来管理所有 spring 依赖项。

我们已在公司存储库中上传了所有 bom 及其依赖项。还经过验证,公司回购中的所有内容都在那里。
在我的 settings.xml 中,正确提及了所有存储库(由公司托管)。但不知何故,对于 spring-framework-bom 项目,maven 仅在中央搜索,即使它在 settings.xml 中被禁用。理想情况下,它应该首先在我们公司的存储库中搜索。

我们得到以下异常。 Exception trace: org.apache.maven.reactor.MavenExecutionException: POM 'org.springframework:spring-framework-bom' not found in repository: Unable to download the artifact from any repository org.springframework:spring-framework-bom:pom:4.0.6.RELEASE from the specified remote repositories: central (http://repo1.maven.org/maven2)

4

2 回答 2

3

当您在其他 pom.xml 中使用导入范围定义 pom/artifact 时,就会出现此问题。

导入的依赖项基本上会丢失存储库信息,他们会尝试在 maven central 中搜索依赖项。

诀窍是将 Maven 中央存储库与您的公司存储库镜像。因此,在导入依赖项的情况下,它将在公司存储库中搜索,而不是默认的 Maven 中心。

希望这可以帮助。

于 2014-08-20T18:03:39.940 回答
0

这是一个错误。这是建议的解决方案:

IMO,使用规定的解决方法(将自定义存储库添加到具有范围 == 导入依赖项的 POM)可能是最安全的方法

它至少在 Maven 3.3.9 中有效。可能已经更早了。

于 2017-01-19T21:46:06.117 回答