2016-05-12 112 views
0

我们试图将maven依赖关系分组到一个单独的maven POM类型项目中。maven import pom(BOM)自己的项目来自内部maven仓库

我们希望将此作为依赖关系节点内的POM类型依赖关系以及de dependencyManagement内的BOM(物料清单)。

我们在公司内部有一个2储存库。 (Apache Archiva - 2.2.0)。 其中一个用于快照,其中一个用于发布。

当我尝试使用快照版本时,一切正常,但是当我想使用发布的版本时,我不断收到错误,因为它一直在寻找中央maven存储库内的依赖关系(我们的pom不在位于)

对我来说,似乎只在快照库中搜索POM依赖项。

<properties> 
    ... 
    <dependency.bla-slf4j-logback-BOM.version>1.0.1</dependency.bla-slf4j-logback-BOM.version> 
    ... 
</properties> 
<dependencies> 
    ... 
    <dependency> 
     <groupId>my.groupid</groupId> 
     <artifactId>bla-slf4j-logback-BOM</artifactId> 
     <version>${dependency.bla-slf4j-logback-BOM.version}</version> 
     <type>pom</type> 
    </dependency> 
    ... 
</dependencies> 
<dependencyManagement> 
    <dependencies> 
     ... 
     <dependency> 
      <groupId>my.groupid</groupId> 
      <artifactId>bla-slf4j-logback-BOM</artifactId> 
      <version>${dependency.bla-slf4j-logback-BOM.version}</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 
     ... 
    </dependencies> 
</dependencyManagement> 

的ErrorMessage:

[ERROR]  Non-resolvable import POM: Failure to find my.groupid:bla-slf4j-logback-BOM:pom:1.0.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ line 234, column 22 -> [Help 2] 

使用的命令:

mvn dependency:tree 
  • Maven版本:阿帕奇Maven的3.2.2
  • archiva版本:阿帕奇Archiva - 2.2.0

我检查了我们的archiva,神器出现在预期的位置。 我也检查了本地maven目录,pom依赖项被正确下载。

任何想法为什么这不适用于我们的POM项目(1.0.1)的发布版本,但适用于我们的POM项目的快照版本(1.0.1-SNAPSHOT)。

+0

你有你的部分元素? –

+0

在settings.xml文件中配置元素和元素。我试着把它放在项目的pom里面,但是这样做的结果是一样的。这种配置在获得位于我们内部的存档库中的任何其他依赖关系时没有问题。 (这是我们第一次尝试在dependencyManagement部分使用POM导入(来自我们的maven仓库),尽管) –

+0

尝试在setting.xml中镜像默认的“中央”maven仓库: UK UK Central http:// yourrepo。com/maven central

回答

1

解决的办法是将下面的xml块添加到maven settings.xml文件中。

<mirrors> 
    <mirror> 
     <id>ourcentral</id> 
     <name>our central</name> 
     <url>http://mavenrepourl.goes.here</url> 
     <mirrorOf>central</mirrorOf> 
    </mirror> 
</mirrors> 

这导致它检查我们的内部maven存储库作为中央maven存储库。 (我们的Maven仓库有默认的中央存储库作为远程仓库)

特别感谢:希沙姆KH