0

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

Tyler Liu
  • 19,552
  • 11
  • 100
  • 84

2 Answers2

2

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!

Daniele
  • 2,672
  • 1
  • 14
  • 20
  • Thanks for the reply. My goal is to allow user to download my library from jcenter() without adding any custom urls in the build script. I've already achieved the goal with ringcentral library. However the ringcentral-pubnub library doesn't work. I need to figure out the root cause. – Tyler Liu Jun 12 '19 at 20:29
0

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!

Tyler Liu
  • 19,552
  • 11
  • 100
  • 84