[英]Cannot install a published Java library
I have published a java library to https://bintray.com/tylerlong/maven/ringcentral-pubnub 我已经将Java库发布到https://bintray.com/tylerlong/maven/ringcentral-pubnub
I tried to use it via gradle: 我试图通过gradle使用它:
dependencies {
...
compile 'com.ringcentral:ringcentral-pubnub:1.0.0-beta10'
}
When I run ./gradlew build
, I got the following error: 当我运行
./gradlew build
,出现以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find com.ringcentral:ringcentral-pubnub:1.0.0-beta10.
Searched in the following locations:
- https://jcenter.bintray.com/com/ringcentral/ringcentral-pubnub/1.0.0-beta10/ringcentral-pubnub-1.0.0-beta10.pom
- https://jcenter.bintray.com/com/ringcentral/ringcentral-pubnub/1.0.0-beta10/ringcentral-pubnub-1.0.0-beta10.jar
Required by:
project :
Here is the build.gradle
file: https://github.com/ringcentral/ringcentral-pubnub-java/blob/master/build.gradle 这是
build.gradle
文件: https : //github.com/ringcentral/ringcentral-pubnub-java/blob/master/build.gradle
I really have no idea why it doesn't work. 我真的不知道为什么它不起作用。 I have another library here and it works like a charm: https://bintray.com/tylerlong/maven/ringcentral .
我在这里还有另一个库,它的工作方式就像一个魅力: https : //bintray.com/tylerlong/maven/ringcentral 。 I published these two libraries in similar way.
我以类似的方式发布了这两个库。 Why one works while the other doesn't?
为什么一个起作用而另一个不起作用?
Here is the sample project to reproduce the issue: https://github.com/tylerlong/ringcentral-pubnub-demo 这是重现此问题的示例项目: https : //github.com/tylerlong/ringcentral-pubnub-demo
In the given Github example; 在给定的Github示例中; you need to configure the Gradle build to use your custom (bintray) maven repository.
您需要配置Gradle构建以使用您的自定义(bintray)Maven存储库。 With the current settings, it only looks in
jcenter
, and your dependency is not available from that repository (hence the error). 使用当前设置,它只会在
jcenter
中jcenter
,并且您的依赖项无法从该存储库中获得(因此会出现错误)。
Make sure your build contains: 确保您的构建包含:
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/tylerlong/maven'
}
}
Regarding 关于
Why one works while the other doesn't?
为什么一个起作用而另一个不起作用?
maybe you published the "one" and the "other" in different ways; 也许您以不同的方式发布了“一个”和“另一个”; so that only one is present in the right repositories?
这样在正确的存储库中只有一个? Or, your build uses
mavenLocal
and you actually installed one dep locally. 或者,您的构建使用
mavenLocal
并且实际上在本地安装了一个dep。 Anyway- double check your repos! 无论如何-请仔细检查您的仓库!
I did everything correctly, but I forgot one last step: link to jcenter. 我正确地完成了所有操作,但是却忘了最后一步:链接到jcenter。
Ref: https://medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890 参考: https : //medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890
After I submit my package to jcenter and I got the following reply: 将包提交给jcenter后,得到以下答复:
Your request to include your package /tylerlong/maven/ringcentral-pubnub in Bintray's JCenter has been approved.
您要求将/ tylerlong / maven / ringcentral-pubnub软件包包含在Bintray的JCenter中的请求已获批准。
Then everything works like a charm! 然后,一切都像一个魅力!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.