【问题标题】:Gradle doesn't find .aar file on Maven repo on BintrayGradle 在 Bintray 上的 Maven 存储库中找不到 .aar 文件
【发布时间】:2017-12-26 08:45:21
【问题描述】:

...即使错误报告了正确的下载 URL。

(下面的 Bintray 详细信息。)

Gradle 回购

repositories {
    jcenter()
    maven { url 'https://dl.bintray.com/myUsername/myRepo/' }
}

依赖关系

compile('com.domain.groupid:library-core:v1.2.3@aar') {
    transitive=true
}
compile('com.domain.groupid:library-support:v1.2.3@aar') {
    transitive=true
}

错误

Error:Could not find library-core.aar (com.domain.groupid:library-core:v1.2.3).
Searched in the following locations:
    https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/v1.2.3/library-core-v1.2.3.aar

如果我复制该 URL,我可以在退出的窗口中下载它。为什么 Gradle 会出现问题?

还有另一个类似的编译依赖项(此处列为library-support),但我假设它没有得到它,因为这个首先失败了。

设置...

我在 Bintray 上有一个个人公共 repo,其中包含两个 android 库。

https://bintray.com/myUsername/myRepo/library-core
https://bintray.com/myUsername/myRepo/library-support

在我的库的 gradle 脚本中,两者都有按 bintray 规则上传的版本。版本上传,我可以在 bintray UI 中看到它们,我可以下载它们并查看它们是否符合我的预期:

https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/maven-metadata.xml
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/library-core-v1.2.3/library-core-v1.2.3-sources.jar
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/library-core-v1.2.3/library-core-v1.2.3.aar
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/library-core-v1.2.3/library-core-v1.2.3.pom
// Same for library-support. All of these download in a signed out window.

gradle 期待别的东西吗?

【问题讨论】:

  • 您能否提供您对 Bintray 的依赖项的 实际 链接?我想重现这个问题。顺便说一句:在 Maven 中为库版本使用 v 前缀是非常罕见的。暗示这个属性的版本。也许这与您的问题有关。
  • 你是赢家。我重新上传了版本名称中没有 v 的内容,并更新了我的依赖项以匹配,生活很好。请发表您的评论作为答案,以便我奖励您一些声誉。
  • 太棒了!请在下面找到答案。

标签: android maven gradle aar bintray


【解决方案1】:

Maven 通常不希望版本属性中出现v 前缀。它由坐标语法的顺序暗示​​:<group>:<name>:<version>。对版本号使用语义版本控制应该可以解决问题。

【讨论】:

    【解决方案2】:

    我有一个类似的问题,添加另一个答案,希望将来能帮助其他人。

    在我的情况下,我首先只将 .jar 文件上传到 maven repo,然后当我上传 .aar 文件时,即使错误 URL 正确链接到工件,它也找不到它。

    添加

    --refresh-dependencies
    

    我的 gradle 命令为我解决了这个问题

    【讨论】:

      猜你喜欢
      • 2013-12-06
      • 2020-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-09
      • 2020-06-22
      • 2015-05-12
      • 2019-10-04
      相关资源
      最近更新 更多