简体   繁体   中英

Cannot install a published Java library

I have published a java library to https://bintray.com/tylerlong/maven/ringcentral-pubnub

I tried to use it via gradle:

dependencies {
    ...

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

When I run ./gradlew build , I got the following error:

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

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 . 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

In the given Github example; you need to configure the Gradle build to use your custom (bintray) maven repository. With the current settings, it only looks in jcenter , and your dependency is not available from that repository (hence the error).

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. Anyway- double check your repos!

I did everything correctly, but I forgot one last step: link to jcenter.

Ref: 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:

Your request to include your package /tylerlong/maven/ringcentral-pubnub in Bintray's JCenter has been approved.

Then everything works like a charm!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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