流程簡要說明:
-
【翻FQ墻】to JCenter https://bintray.com
選擇免費的入口進行注冊:
image.png -
記住自己注冊的用戶名
image.png -
獲取API key [暫存,后面上傳gradle指令需要使用]
image.png -
進入jcener后Add new Repository
image.png
需要注意的是添加的 Repository 的name maven和 as 中配置的
repoName = "maven" // #倉庫名 一致

image.png
- 在需要上傳的庫根目錄下添加依賴[簡化jcenter的上傳依賴gradle 庫]
classpath 'com.novoda:bintray-release:0.x.x' [注意這里的版本和as的gradle有對應關系 ][https://github.com/novoda/bintray-release](https://bintray.com/)
- 在需要push的 module 對應的build.gradle 文件中添加配置:
apply plugin: 'com.novoda.bintray-release'
publish {
artifactId = 'literouter'// # artifactId
uploadName = 'LiteRouter'// ## 展示名字
publishVersion = '1.0.1'
userOrg = rootProject.userOrg
groupId = rootProject.groupId
desc = rootProject.desc
website = rootProject.website
licences = rootProject.licences
}
- 上面是抽取了共性部分的使用,在根目錄下的gradle中ext:
ext {
userOrg = 'your register name' // #用戶名
repoName = "maven" // #倉庫名
groupId = 'com.sparoj'// #groupId :xxx
desc = 'lite router for moudles' // #描述
website = 'https://github.com/xxx/xxx.git'// #地址,填寫真實可訪問地址
licences = ['Apache-2.0'] // # 描述,填寫licences
}
// 其他相同project 下的 module 上傳配置方式一致,注意替換對應的artifactId 和 uploadName、publishVersion 即可
- 使用前面view profile 得到的 key 通過如下gradle 指令在終端push 到 已經(jīng)create 好的 JCenter(your Repository)中即可
./gradlew clean build bintrayUpload -PbintrayUser=name -PbintrayKey=xxxkeyxxx -PdryRun=false
完成之后即可在個人的JCenter 主頁中看到相關庫
-
發(fā)布到 JCenter (add to JCenter )才可以在項目中依賴使用
image.png 項目使用:
compileOnly 'com.xxxxx:annotation:1.0.1'
compileOnly 'com.xxx:xxxrouter:1.0.1'
annotationProcessor 'com.xxx:compiler:1.0.1'




