一 注册一个 bintray 账号
注册的方法比较简单,这里就不说了。注册网址 https://bintray.com/signup/oss
二 bintray 上传教程
在根 build.gradle 添加以下代码
buildscript {
...
dependencies {
classpath 'com.novoda:bintray-release:0.+' // 0.+ 表示最 0.xx新版
}
}
然后在项目的 build.gradle 文件添加
publish {
// 各个字段的含义见 https://github.com/novoda/bintray-release/wiki/Configuration-of-the-publish-closure
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def user = properties.getProperty('BINTRAY_USER')
def key = properties.getProperty('BINTRAY_KEY')
userOrg = user // 用户名
repoName = 'maven'
dryRun = false // 重要
groupId = _group
artifactId = _artifactId
publishVersion = _version
desc = 'a dev tool lib for asm-plugin lib'
website = _siteUrl
bintrayUser = user // 用户名
bintrayKey = key // api key 在个人信息里面可以查询到
}
上传成功后,在 bintray 的 maven 详细页面有个 action ,点击后有个 add to Jcenter 。 点击后会推送到 jcenter 然后等待审核通过。
另外一个小 tips ,就是如果访问不了 https://bintray.com/ 的话,可以试试修改电脑的 DNS 为 114.114.114.114 和 8.8.8.8 。