繁体   English   中英

无法安装已发布的Java库

[英]Cannot install a published Java library

我已经将Java库发布到https://bintray.com/tylerlong/maven/ringcentral-pubnub

我试图通过gradle使用它:

dependencies {
    ...

    compile 'com.ringcentral:ringcentral-pubnub:1.0.0-beta10'
}

当我运行./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 :

这是build.gradle文件: https : //github.com/ringcentral/ringcentral-pubnub-java/blob/master/build.gradle

我真的不知道为什么它不起作用。 我在这里还有另一个库,它的工作方式就像一个魅力: https : //bintray.com/tylerlong/maven/ringcentral 我以类似的方式发布了这两个库。 为什么一个起作用而另一个不起作用?

这是重现此问题的示例项目: https : //github.com/tylerlong/ringcentral-pubnub-demo

在给定的Github示例中; 您需要配置Gradle构建以使用您的自定义(bintray)Maven存储库。 使用当前设置,它只会在jcenterjcenter ,并且您的依赖项无法从该存储库中获得(因此会出现错误)。

确保您的构建包含:

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

关于

为什么一个起作用而另一个不起作用?

也许您以不同的方式发布了“一个”和“另一个”; 这样在正确的存储库中只有一个? 或者,您的构建使用mavenLocal并且实际上在本地安装了一个dep。 无论如何-请仔细检查您的仓库!

我正确地完成了所有操作,但是却忘了最后一步:链接到jcenter。

参考: https : //medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890

将包提交给jcenter后,得到以下答复:

您要求将/ tylerlong / maven / ringcentral-pubnub软件包包含在Bintray的JCenter中的请求已获批准。

然后,一切都像一个魅力!

暂无
暂无

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

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