novoda/bintray-release
使用這個插件上傳比較簡單,只需要兩步就可以
1.在項目根目錄下的 build.gradle 添加插件依賴
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.novoda:bintray-release:0.9'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
- 在開源庫的目錄中 build.gradle 中配置上傳的信息,同樣配置到文件的最后。
apply plugin: 'com.novoda.bintray-release'
publish {
repoName = "maven"
userOrg = 'youaccount'
groupId = 'com.test.novoad'
artifactId = 'test-novoad'
publishVersion = '1.0.0'
desc = 'novoad bintraybuild project'
website = 'https://github.com/you project'
}
- 發布我們的開源項目,在 Terminal 輸入以下命令,替換 BINTRAY_USERNAME 和 BINTRAY_KEY 為你自己的 user 和 API key,執行命令之前需 Gradle Build。
4.在終端輸入命令
./gradlew clean build bintrayUpload -PbintrayUser=BINTRAY_USERNAME -PbintrayKey=BINTRAY_KEY -PdryRun=false
可以到上傳成功
可能不同版本會有差異詳情請參考