2014-03-24 126 views
10

我尝试添加以下的依赖:摇篮下载相关性错误

compile group: 'com.cedarsoft.commons', name:'test-utils', version:'5.0.9' 

摇篮下载了几个瓶子,然后我得到了以下错误:

POM relocation to an other version number is not fully supported in Gradle : xml-apis#xml-apis;2.0.2 relocated to xml-apis#xml-apis;1.0.b2. 
Please update your dependency to directly use the correct version 'xml-apis#xml-apis;1.0.b2'. 
Resolution will only pick dependencies of the relocated element. Artifacts and other metadata will be ignored. 

任何想法,为什么以及如何解决这个问题?

回答

4

如果你看一看在Maven Central神器并下载POM文件,你会得到这样的:

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>xml-apis</groupId> 
    <artifactId>xml-apis</artifactId> 
    <version>2.0.2</version> 
    <distributionManagement> 
    <relocation> 
    <groupId>xml-apis</groupId> 
    <artifactId>xml-apis</artifactId> 
    <version>1.0.b2</version> 
    </relocation> 
    </distributionManagement> 
</project> 

这意味着神器可以根据new coordinates这意味着你需要使用被发现使用该artiact的新坐标。我假设你没有直接通过传递依赖来直接使用这个工件。这意味着您需要用新的工件坐标重写传递依赖关系。

15
configurations.all { 
    resolutionStrategy { 
     force 'xml-apis:xml-apis:1.4.01' 
    } 
} 

或使用1.0.b2。问题是xml-apis的POM重定向到2.0.2(如khmarbaise写的)到同一个组和同一个artefact,只有版本是1.0.b2,它以某种方式愚弄了Gradle(或底层Ivy)解析机制。

功劳归马克彼得罗维奇Gradle Forum