2014-03-24 125 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