利用bintray-release插件上傳到jcenter

按照Hongyang的教程利用bintary-release插件遇到了trick。

HTTP/1.1 404 Not Found [message:Repo ‘maven’ was not found]

反覆修改,最終借鑑這篇文章得以解決。

下面總結一下利用bintary-release插件上傳自己的庫到jcenter.

1.註冊bintray.com賬號

進入https://bintray.com/,註冊賬號。

這裏寫圖片描述

如果直接註冊,會出現Edit Profie頁面只有五個選項,沒有Repositories,而網上貼圖有如下7個選項,有Repositories 和GPG signing

這裏寫圖片描述

註冊完成之後拷貝API-key:

這裏寫圖片描述

(2)引入bintray-release

在項目的build.gralde

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.novoda:bintray-release:0.4.0'
    }
}

在moudle的build.gralde

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

……

publish {
    userOrg = 'rolyyu'//bintray.com用戶名
    groupId = 'com.rolyyu'//jcenter上的路徑
    artifactId = 'projectname'//項目名稱
    publishVersion = '1.0.0'//版本號
    desc = 'Oh hi, this is a nice description for a project, right?'
    website = 'https://github.com/Rolyyu'
}

終端輸入:

./gradlew clean build bintrayUpload 
-PbintrayUser=rolyyu
-PbintrayKey=XXXXXXXXXXXXXXXXXX
-PdryRun=false

這裏寫圖片描述

當運行完成,看到BUILD SUCCESSFUL就沒問題了

(3)同步到jcenter

訪問https://bintray.com/你的用戶名/maven,即可看到:

https://bintray.com/rolyyu/maven

這裏寫圖片描述

不過目前還是不能直接引用的,你需要等待bintray的工作人員審覈,審覈通過會給你發送站內Message,等待審覈通過:

這裏寫圖片描述

測試訪問該網站https://jcenter.bintray.com/你的groupId例如:

https://jcenter.bintray.com/com/rolyyu/

如果出現下圖即表示成功:

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章