Gradle下载依赖性错误

Urb*_*leg 13 build gradle maven

我正在尝试添加以下依赖项:

compile group: 'com.cedarsoft.commons', name:'test-utils', version:'5.0.9'
Run Code Online (Sandbox Code Playgroud)

Gradle下载了几个罐子,然后我收到以下错误:

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.
Run Code Online (Sandbox Code Playgroud)

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

Pio*_*hen 18

configurations.all {
    resolutionStrategy {
        force 'xml-apis:xml-apis:1.4.01'
    }
}
Run Code Online (Sandbox Code Playgroud)

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

归功于Mark Petrovic Gradle论坛


khm*_*ise 7

如果您查看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>
Run Code Online (Sandbox Code Playgroud)

这意味着可以在新坐标下找到工件,这意味着您需要使用新坐标来使用该工艺.我假设您不直接仅通过传递依赖使用该工件.这意味着您需要使用新的工件坐标覆盖传递依赖关系.