【问题标题】:Gradle incorrectly resolving dependency artifactIdGradle 错误地解析依赖 artifactId
【发布时间】:2015-07-04 00:02:30
【问题描述】:

我有一个看起来像这样的依赖项:

dependencies {
    apt 'io.sweers.barber:barber-compiler:1.3.0'
    compile 'io.sweers.barber:barber-api:1.3.0'
}

这种依赖在 jcenter 和 mavenCentral 中都存在,但是每当 gradle 解析它时,它使用了不正确的 artifactId(去掉了“barber-”前缀)。

Error:Could not find io.sweers.barber:api:1.3.0.
Searched in the following locations:
    https://jcenter.bintray.com/io/sweers/barber/api/1.3.0/api-1.3.0.pom
    https://jcenter.bintray.com/io/sweers/barber/api/1.3.0/api-1.3.0.jar
    https://maven.fabric.io/public/io/sweers/barber/api/1.3.0/api-1.3.0.pom
    https://maven.fabric.io/public/io/sweers/barber/api/1.3.0/api-1.3.0.jar
    file:/Users/hsweers/dev/android/android-sdk/extras/android/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.pom
    file:/Users/hsweers/dev/android/android-sdk/extras/android/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.jar
    file:/Users/hsweers/dev/android/android-sdk/extras/google/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.pom
    file:/Users/hsweers/dev/android/android-sdk/extras/google/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.jar
Required by:
    MyAppProject.app:unspecified > io.sweers.barber:barber-compiler:1.3.0

如果依赖可以正确解析为https://jcenter.bintray.com/io/sweers/barber/barber-api/1.3.0/barber-api-1.3.0.pom

如果有帮助,可以在此处找到该库:https://github.com/hzsweers/barber

【问题讨论】:

  • 如果我从dependencies 中删除apt 'io.sweers.barber:barber-compiler:1.3.0',Gradle 似乎找到了依赖关系,或者至少可以毫无问题地处理build.gradle 文件。有了那条线,它就会因您在问题中显示的错误而中断。不知道这意味着什么,但也许这对你来说是一个有用的线索。
  • 是的,我认为我已经将其范围缩小了一点,因为库版本本身存在问题。它将编译器模块中生成的 POM 替换为具有 mavencentral 必要信息的自定义 POM。问题是,生成的 POM 指定了错误的 artifactId。打算再挖一些

标签: android maven gradle android-gradle-plugin jcenter


【解决方案1】:

原来问题出在我的库中,导致为编译器模块生成的 pom 使用 api 模块名称而不是它的 artifactId。暂时修复它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-17
    • 2014-11-12
    • 1970-01-01
    • 2019-04-24
    • 1970-01-01
    • 1970-01-01
    • 2015-12-19
    • 1970-01-01
    相关资源
    最近更新 更多