Gradle发布项目到 maven 之novoda/bintray-release(3)

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
}
  1. 在开源库的目录中 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'
}
  1. 发布我们的开源项目,在 Terminal 输入以下命令,替换 BINTRAY_USERNAME 和 BINTRAY_KEY 为你自己的 user 和 API key,执行命令之前需 Gradle Build。

  4.在终端输入命令

./gradlew clean build bintrayUpload -PbintrayUser=BINTRAY_USERNAME -PbintrayKey=BINTRAY_KEY -PdryRun=false

 可以到上传成功

可能不同版本会有差异详情请参考

https://github.com/novoda/bintray-release

https://github.com/novoda/bintray-release/wiki中文

posted on 2019-01-11 17:46  mingfeng002  阅读(2886)  评论(0编辑  收藏  举报