簡體   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