如何发布自己的 lib 库到 jcenter

一 注册一个 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 。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值