导入范围poms的问题(spring bom io依赖问题)

时间:2014-08-13 12:41:43

标签: maven spring-io

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

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

我们已将所有boms及其依赖项上传到我们的公司存储库中。也验证了,公司回购中的一切都在那里 在我的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)

2 个答案:

答案 0 :(得分:3)

当您在其他pom中使用 import 范围定义了pom / artifact时,会出现此问题。

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

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

希望这会有所帮助。

答案 1 :(得分:0)

它是bug。这是建议的解决方案:

  

IMO,使用所述的解决方法(将自定义存储库添加到具有范围== import依赖关系的POM)可能是最安全的方法

至少在Maven 3.3.9中有效。可能已经提前了。

相关问题