简体   繁体   English

Gradle在Bintray上的Maven repo上找不到.aar文件

[英]Gradle doesn't find .aar file on Maven repo on Bintray

... even when the error reports the correct download URL. ...即使错误报告了正确的下载URL。

(Bintray details below.) (Bintray详情如下。)

Gradle Repo Gradle Repo

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

Dependencies 依赖

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 错误

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

If I copy that URL, I can download it in a signed out window. 如果我复制该URL,我可以在签出窗口中下载它。 Why does Gradle have a problem with it? 为什么Gradle有问题呢?

There is another similar compile dependency (listed here as library-support ), but I'm assuming it didn't get to it because this one failed first. 还有另一个类似的编译依赖项(这里列为library-support ),但我假设它没有达到它,因为这个首先失败了。

The setup... 设置......

I have a personal public repo on Bintray, with two android libraries. 我有一个关于Bintray的个人公共回购,有两个安卓库。

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

Both have versions upload by the bintray rule in my library's gradle scripts. 两者都有我的库的gradle脚本中的bintray规则上传的版本。 The versions upload, I can see them in the bintray UI, and I can download them and see that they are what I expected: 版本上传,我可以在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.

Is gradle expecting something else? gra gra期待别的吗?

Maven usually doesn't expect the v prefix in the version attribute. Maven通常不期望version属性中的v前缀。 It's implied by the order of coordinate syntax: <group>:<name>:<version> . 它由坐标语法的顺序暗示​​: <group>:<name>:<version> Using semantic versioning for the version number should do the trick. 对版本号使用语义版本控制应该可以解决问题。

I had a similar issue, adding another answer to hopefully help others in the future. 我有一个类似的问题,添加另一个答案,希望将来帮助其他人。

In my case, I first only uploaded the .jar file to the maven repo, then when I uploaded the .aar file, it couldn't find it even though the error URL properly linked to the artifact. 在我的情况下,我首先只将.jar文件上传到maven repo,然后当我上传.aar文件时,即使错误URL正确链接到工件,它也找不到它。

Adding 添加

--refresh-dependencies

to my gradle command fixed the issue for me 我的gradle命令为我解决了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM