3d开奖号455前后关系

Android中文API
ADC-Android API Android SDK Android Studio
当前位置: 主页 > Android开发文档 >

如何发布一个开源库到 JCenter

时间:2018-05-07 23:26来源:未知 作者:小q 点击:
今天想来分享下,如何一步步自己发布一个开源库到 JCenter 这方面的博客网上已经特别多了,所以本篇并不打算仅仅只是记录流程步骤而已,而是尽可能讲清楚,为什么需要有这个步骤

3d开奖号455前后关系 jintianxianglaifenxiangxia,ruheyibubuzijifabuyigekaiyuankudao jcenter

3d开奖号455前后关系 zheifangmiandebokewangshangyijingtebieduole,suoyibenpianbingbudasuanjinjinzhishijiluliuchengbuzhoueryi,ershijinkenengjiangqingchu,weishenmexuyaoyouzheigebuzhou,rangdahuozhiqirandetongshihaizhiqisuoyiran,neimezhangwojiuhuigengshenkeyidian,suoyibenpianpianfuhuihenzhang。lingwai,benpianshicankao、yinyong、jiejianleyixiawenzhangzhongdeneirong:

3d开奖号455前后关系 suiranshiyingwenban,danyousijijichujiukeyijibenkandongle,wenzhangxiedehenquan,henxiang

shizaibuxiangkanyingwenbande,guoneiyouzhongwenbanfanyi,zai***《androidgaojijinjie》***dedi 9 zhangyouwanzhengbandezhongwenfanyi

前言

首先得想清楚一件事:是不是只有写得很牛的开源库,或者只有牛人、大神才可以发布开源库到 JCenter呢?

kenengyouxierenjuedezijibushidashen,zijixiebuchushaniubidekaiyuanku,suoyibuyongfabudao jcenter shangjibierenyong。suoyi,dexianxiangqingchu,niweishenmeyaofabuyigekaiyuankudao jcenter shangqu?

xuexiyexing;fenxiangyexing;zijiyongyexing;zongzhi,meishenmeguidingshuozhiyoudashencaikeyifabu;

3d开奖号455前后关系 qishi,zheilizhisuoyijiaozuokaiyuanku,shiyinweifabudao jcenter shangzhihou,dahuodoukeyishiyongdeyuanyin。wogengxihuanzai《androidgaojijinjie》lideshuofa:hanshuku

3d开奖号455前后关系 woshidaizhezheimeyizhongxiangfade:

zuoweiyigelanren,yixiekeyizaiduogexiangmuzhongshiyongdegonggongjichumokuai,shizaibuxiangmeicixinjianxiangmudoushoudongqufuzhizhantie,huozheshoudongqudao module,suoyijiuxiangzhejiangzheixiegonggongjichumokuaidabaofabudao jcenter,yihouxinjianxiangmushizhiyaopeizhixia build.gradle jiukeyile

3d开奖号455前后关系 q:niwenwoweishabushangchuandaosifu?

a:meiqian

3d开奖号455前后关系 q:niwenwoneibupadaimabeidaoyong?

3d开奖号455前后关系 a:youbushishenmeniubidekaiyuanku,jiushiyixiejibendegonggongmokuairugongjulei,wangluocengfengzhuangdengdeng,bierenxiangyong,wogaoxinghailaibuji,pasha

3d开奖号455前后关系 q:niwenwoneizheixiejichumokuaiweishabuyongbierenkaiyuande,haiyaozijizaolunzi?

3d开奖号455前后关系 a:zijideyongzheshunshou,zijidexiangzenmegaijiukeyizenmegai

q:niwenwoneibupafabudekaiyuankudaimataicaogao,beirenma?

3d开奖号455前后关系 a:laoge,woyoubushidashen,woyaobuxiezheipianboke,doumeirenzhidaowofabulegekaiyuanku,fanzhengjiuwozijishiyong,pasha

q:niwenwo...

a:laoge,biewenle,gankuaiqufabuyigeshishikanba,wanyiyihounijiushidashenleni,shengdedaoshizaixianxue

haole,jiexiaqujiukaishijiangfabudebuzhoule

步骤

xiandaoyongkaitoufenxiangdelianjielideyizhangtu

 

流程.png

 

zhenggeliuchengqishijiushishangtuzhongjieshaodezheiyang,xianbendidabaocheng jar huo aar wenjian,ranhoushangchuandao bintray zijidecangkuzhong,zuihoufabudao jcenter shangqujiukeyile。

chulediyibushizaibendizijicaozuowai,shengxiadecaozuodoushizaiwangyeshangyiyishubiaodianyidianjiukeyile

第 0 步:JCenter 网址

3d开奖号455前后关系 weishenmehuiyoulianggeni?neishiyinwei,diyigeshitigongjiwomenke ui jiaohucaozuodewangzhan,zhucezhanghao、peizhicangku、fabudengdengcaozuodoushizaidiyigewangzhishangmiancaozuo,womenyezhiyaojizhudiyigewangzhanjiukeyile

3d开奖号455前后关系 diergeshicunfangzheixiekaiyuankudewangzhi,ruguonixiangshoudongxiazaimougekaiyuankude jar,neimenikeyizhijiezaidiergewangzhihoumianjiashangkaiyuankudelujingjike

3d开奖号455前后关系 biru,wozhiqianxieguoyipian ,mouxieqingkuangxia,android studio bingmeiyouchenggongjiang android gradle chajiandeyuanmaxiazaixialai,womenyouxiangquchakanyuanmashi,zhinengzijiquxiazai。xieneipianbokedeshihou android studio haishimorenpeizhide mavencentral zuoweikaiyuankulaqulaiyuande。

danxianzaixinbande android studio yijinggaichengmorenpeizhi jcenter zuoweikaiyuankudelaiyuanle,jugelizi:

compile 'com.squareup.okhttp:okhttp:2.4.0'

ruguoxiangshoudongxiazai okhttp de jar bao,neimejiushifangwen:http://jcenter.bintray.com/com/squareup/okhttp/okhttp/2.4.0/

yicileitui

第 1 步:注册账号 & 创建仓库

1.1 注册账号

3d开奖号455前后关系 dakai wangzhan,zhuceyigezhanghao,yekeyixuanzezhijie github zhanghaoshouquandenglu,henjiandan,butietule。

1.2 创建仓库

dengluzhanghaohou,gen github caozuoleisi,bintray yunxunizaiwangzhanshangchuangjianzijidecangku,ke public,ke private。

3d开奖号455前后关系  

创建模块.png

3d开奖号455前后关系  

3d开奖号455前后关系 chuangjiancangkudecaozuogen github shileiside,wojiubuyanshile,wozheilichuangjianleyigejiao base-module dekongcangku。

3d开奖号455前后关系 jiexiaqujiugen github degainianyoudianbuyiyangle,zai github shangwomenyigecangkutongchangduiyingyigejutidexiangmu,bendixiangmuzhangshayang,github shangdecangkujibenyejiuzhangshayang。

在 bintray 这里,一个仓库我更倾向于把它就理解成仓库的意思,也就是作为容器的作用。创建完一个空仓库后,页面右下角会有一个 Add New Package3d开奖号455前后关系 按钮,也就是仓库下面还有一层 package 的概念。

yige package jiushiyigekefabudao jcenter shangdekaiyuanbao,erfabudao jcenter shangdeneirongshiyixie pom,aar,jar zhileidewenjian,bingbushizhenggexiangmu。suoyiwomenxuyaoxianchuangjianyige package laizhunbeijibendixuyaodabaofabude module shengcheng pom,aar dengwenjiandecunfangdile。

第 2 步:配置本地 gradle 脚本插件

shangchuandao github shangdeshizhenggexiangmudeyuanma,ershangchuandao bintray shangdeshi pom, jar,arr zheileiwenjian。

suoyi,zaifabukaiyuankudao jcenter zhiqian,womenxuyaoxianzaibendijiangyaofabude module dabaocheng jar, aar。neime,zaibendiyaozenmecaozuoni?jiuxiang google tigongle android gradle chajianlaifangbiankaifazhezhijieduixiangmujinxingbianyiyiyang,bintray yetigonglexiangduiyingde gradle chajian,laifangbianwomenzhijiezaibendidabaocheng jar。

3d开奖号455前后关系 tongyang,github zhichitongguo git laijiangbendixiangmushangchuandao github shang,er bintray yetigongleduiyingde gradle jiaobenlairangkaifazhejiangbendidabaohoude jar dengshangchuanzhi bintray wangzhanshangdecangkuzhong。

3d开奖号455前后关系 zheijiushiweishenmewomenxuyaozaibendipeizhiyixie gradle chajiandeyuanyin,yizhefangbiankaifazheduixiangmujinxingbianyi、dabaochengsuoxudewenjian;erzhetongguotatigongdeqiaoliangshangchuanzhi bintray wangzhanshangdecangku。

2.1 配置 gradle 插件地址

shiyong android gradle chajian,xuyaozaigenxiangmude build.gradle wenjianzhongpeizhi:

dependencies {
	classpath 'com.android.tools.build:gradle:2.3.3'
}

同样的道理,要使用 bintray gradle 插件,同样也得在根项目的 build.gradle 文件中配置

 dependencies {
	//Android Gradle 插件
	classpath 'com.android.tools.build:gradle:2.3.3'
	//bintray 插件
	classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
	classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
	//android-maven-gradle-plugin:1.3版本有bug,网上很多例子用的这个版本,编译的时候可能会出错,改一下版本就好了
}

yishang,zhishipeizhilechajiandelujing,neimeshiyongchajiandedifangkendingjiushizaiduiying module xiade build.gradle wenjianzhongle

2.2 使用 gradle 插件

gradle 插件使用的地方都是在每个具体 module 下的 build.gradle 文件中:

apply plugin: 'com.android.library'

android {
    ...
}

yishangshichangjiande build.gradle wenjian,zheibiaoshideshi,jianghuishiyong android gradle chajianzhong id wei com.android.library de gradle chajianlaijianggai module goujianchengyige library,er build.gradle liqitapeizhixiangru android dengzebiaoshigoujiangaixiangmusuoxudeyixiepeizhi,zheishiwodui gradle delijie(buzhidaoduibudui)。

3d开奖号455前后关系 tongyang,yinweishangchuandao bintray deshiyixie pom, jar wenjian,suoyiwomenyexuyaozaizheige build.gradle zhongshiyong bintray tigongdechajianlaibianyi,dabaoxiangmu:

//切记:以下代码必须放在 build.gradle 文件末尾
apply from: 'http://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'http://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

3d开奖号455前后关系 yishang apply from zhideshigai module xuyaoshiyongyigecunchuyuwangshangde gradle jiaobenwenjianlaigenjugezhongpeizhixianglaibianyi、dabaoxiangmu。

3d开奖号455前后关系 zhisuoyizheige gradle jiaobenwenjiancunchuzaiwangluoshang,chuncuishiyinwei bintray danxinwomenbuzhidaozenmeshiyongtatigongde gradle chajianlaishengcheng pom, jar dengwenjian,suoyilianmobanjiaobendoutigongjiwomenle(zheishiwodelijie)。

suoyi,nikeyijiang apply from houmiandelianjiezaiwangyeshangshurukankan,nihuikandaoyixiajiaoben:

//以下代码大概瞄一眼即可,不用细看
apply plugin: 'com.github.dcendents.android-maven'

group = publishedGroupId //开源库的 groupId

install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'//将项目打包成 aar
                groupId publishedGroupId
                artifactId artifact

                // Add your description here
                name libraryName
                description libraryDescription
                url siteUrl

                // Set your license
                licenses {
                    license {
                        name licenseName
                        url licenseUrl
                    }
                }
                developers {
                    developer {
                        id developerId
                        name developerName
                        email developerEmail
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl

                }
            }
        }
    }
}

3d开奖号455前后关系 zheishiyigejiangxiangmudabaocheng arr,bingshengchengxiangmude pom.xml wenjiandejiaoben,zheixiewenjiandoushiyaoshangchuandao bintray wangzhanshangnidecangkuzhongqude。

suoyi,ruguonizhidaoshiyong bintray gradle chajiandouxuyaojinxingnaxiepeizhidehua,niwanquankeyizijizai build.gradle jiangshangshujiaobenzhongsuoxudepeizhizhijiexieshangjiuhao,buyongshiyong apply from;huozhe,nigenju apply from houmiandelianjiejiangjiaobendaimafuzhizhantiedao build.grale wenjianzhongyexing。

3d开奖号455前后关系 tongyangdedaoli,lingwaiyige apply from suotigongde gradle jiaobenneirongwojiubujietule,neigejiaobendezuoyongshiyongyujiangshengchengde pom, aar dengwenjianshangchuanzhinide bintray wangzhandecangkuzhongqude。

也就是说,bintray 提供了两个 gradle 插件,一个用于将本地项目编译,打包成 aar,并生成所需的 pom.xml 等文件;另一个用于将生成的这些文件都上传至你的 bintray 仓库中去。同时,bintray 还提供了两份脚本配置模板,如果不懂得怎么使用,就参照这两份模板来就行了

2.3 修改 gradle 脚本模板文件中的配置项

3d开奖号455前后关系 jirantigongdejinjinshimobanwenjian,neimejutidepeizhixiangkendingshixuyaowomengenjuzijideshijixiangmulaijinxingpeizhide。youliangzhongfangshi:

  • 不使用 apply from,直接将脚本模板文件里的代码拷贝至 build.gradle 中,然后根据具体项目,手动修改每一个配置项(略麻烦,不推荐)
  • 脚本模板文件中,每一个配置项都使用了对应的变量来配置,那么我们只需在 build.gradle 中声明这些变量,并对变量进行赋值,就可以了

android gradle bianyixiangmudeyongfaqishijiushidiyizhong,danyouyuwomendui android xiangmubianyiyaopeizhidexiangdoutingshuxile,jiashang android studio huizidongshengchengyixiebiyaodepeizhixiang,suoyibingbumafan。danyouyudui bintray gradle chajiandepeizhixiangbushu,gerenbujianyizheiliyeshiyongzheizhongfangshi。

erdierzhongfangshi,ruguoniyouxingquzaiquwangshangsousuoxiaqitadezheileijiaochengdewenzhang,kenengnihuifaxian,henduowenzhangdouhuirangnizai build.gradle wenjianzhongxiezheimeyiduandaima:

//下一步会具体来看每个配置项含义
ext {
    bintrayRepo = 'maven'
    bintrayName = 'fb-like'

    publishedGroupId = 'com.inthecheesefactory.thecheeselibrary'
    libraryName = 'FBLike'
    artifact = 'fb-like'

    ...
}

xianzaikeyilijie,weishenmetamenyaonixiezheiduandaimaleba。yinwei bintray tigongdejiaobenmobanwenjianzhong,duitasuoxudepeizhixiangdoushiyonglexiangduiyingdebianliang,neimewomenruguozhijieshiyongjiaobenmobanwenjian,jiuxuyaoduizheixiebianliangjinxingshengmingbingfuzhi,yejiushishuozai ext zhong shengmingde bintrayrepo, libraryname dengdengzheixiebianliang,qishidoushiyinweitamenzai bintray tigongdejiaobenmobanwenjianzhongbeishiyongle。

3d开奖号455前后关系 lingwai,youyu gradle jiaobenshianshunxuzhixingdaima,suoyishengmingzheixiebianliangdedaimabixuzai apply from daimazhiqian,fouzeruguoxianzhixingle apply from,huibaozhaobudaoxiangduiyingdebianliangcuowu。

haiyouyidian,bintray gradle chajianyuanmawomeiqushenrukan,danyaorangxiangmushengchengduiyingde pom xiangmushuomingwenjian,yijidabaocheng aar,suoyiwocaice,zheibiaoming bintray gradle chajianneibuchulejiaobenmobanshangsuoliedegezhongpeizhixiangwai,haixuyao android gradle chajiandeyixiepeizhixiang,biru build.gradle lide android kuaipeizhixiang。

zheiyeshiweishenmeqitawenzhanglitidaoshuo,yaojiang apply from zheijixingdaimafangzai build.gradle zuihoudeyuanyin。yinwei gradle jiaobenshianshunxuzhixingdaima,er bintray gradle chajiandeyunxingyouyilaiyuyixie android peizhixiang,suoyiruguojiang apply from fangzaikaitoudehua,huibaozhaobudaoyixiebianliangdecuowu。

2.3.2 将变量的声明赋值代码写在单独的脚本文件中(可选)

3d开奖号455前后关系 ruguobuxiangrang build.gradle wenjianzhongyoutaiduogenbianyixiangmubenshenwuguandedaima,neimekeyijianggen bintray gradle chajianxiangguandedaimadoudanduxiezailingwaiyige gradle wenjianzhong,ranhouzaigai build.gradle kaitoutongguo apply from jiangneige gradle wenjianyingyongjinlaijike,youdianleisiyu import degainian。

//build.gradle 文末
//bintray-config.gradle 就是跟 build.gradle 同层目录下的一个 gradle 文件,里面就是单纯将 exe {} 这块代码里的变量声明和赋值拷贝至 bintray-config.gradle 文件里
apply from: 'bintray-config.gradle'
apply from: 'http://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
apply from: 'http://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'

第 3 步:设置 gradle 插件中各种配置项

3d开奖号455前后关系 di 2 buzaiyupeizhigezhongsuoxude gradle chajianyijiruheshiyong,zhiyujiaobenmobandemeiyixingdaima,ganxingqudekeyiqushenjiu,danbuquguanyemeshi,fanzhengdagaizhidaolianggejiaobendouganleshenmeshijiuxing,zenmegandejiubuyongquguanle。

neimejiexiaqujiugailejieyixia,douxuyaoduixiangmujinxingnaxieshuxingdepeizhi,zheixiechajiancaikeyizhengchangyunxing,caikeyizhengchangdejiangkaiyuankushangchuanzhi bintray shangdecangkuqu:

3.1 各种基本配置项
ext {
    //bintray 网站上你创建的仓库的名字(必配项)
    bintrayRepo = 'base-module'
    //在这个仓库下的 package name(必配项)
    bintrayName = 'tv'
    //以上两项均只是指向 bintray 网站上你的仓库和仓库下的package

    //publishedGroupId:artifact:libraryVersion 构成你开源库的唯一路径
    //例如:com.dasu.tv:tv:0.0.1,在build.gradle里就可以根据这个路径来compile依赖库了
    //以下三项均是必配项
    publishedGroupId = 'com.dasu.tv'
    artifact = 'tv'
    libraryVersion = '0.0.1'

    //以下三项只是对开源库的描述(应该不是必配项吧,没尝试过)
    libraryName = 'tv'
    libraryDescription = 'dasu 封装的常用,可公用的 tvui 库'
    siteUrl = 'http://github.com/woshidasusu/base-module/tree/master/tv'

    //开源库对应的 github 地址,不知道可不可以不配,应该也是必配
    gitUrl = 'http://github.com/woshidasusu/base-module.git'

    //开发者信息,也是必配的吧
    developerId = 'dasu'
    developerName = 'dasu'
    developerEmail = ''

    //这部分可以不用改,我也不大懂这些开源协议,但应该都一样
    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}

3d开奖号455前后关系 jiuxiang build.gradle wenjianyiyang,youxieshuxingbixupeizhihouxiangmucaikeyizhengchangbianyi,yunxing。yaoshiyong bintray gradle chajianlaijinxingshengchengduiyingde pom,aar wenjian,shangchuandao bintray cangkudenggongneng,yebixujinxingyixieshuxingpeizhicaixing。

zongzhi,duiyingzai bintray cangkudexinxikendingxuyaopeizhi,fabudao jcenter houdeweiyilujingyexuyaopeizhi,kaifazhexinxidangranyexuyao,qitahaixuyaoyixiekaiyuankudemiaoshuxinxiyijikaiyuanxieyixinxi。

3.2 配置身份验证信息(敏感信息)

jingchangshiyong github kendinghaijuedexuyaoguanjiandeyonghugenmiyaoxinxishibushi,fouzeshiyong git shangchuanxiangmudao github shangshimeibanfajinxingshenfenyanzheng。

tongyangdedaoli,yaojiangjingguo bintray gradle chajianshengchengde pom,aar dengshangchuandao bintray cangku,tongyangxuyaojinxingshenfenyanzheng,neimejiupeizhiyixieyonghuminghe key deguanjianxinxi,danzheixiexinxiyoujiqimingan,yinsi,suoyizhinengpeizhizaibendiwenjianzhong。

如果不修改那两份脚本模板文件的话,那么这些信息就需要配置在项目的根目录下面的 local.properties 文件中:

//根目录下的local.properties文件 
bintray.user= woshidasusu
bintray.apikey= XXXXXXX

bintray.user jiushinide bintray wangzhandedengluzhanghao,ruguoniyong github shouquandenglu,jiushinide github zhanghao。

bindtray.apikey xuyaojinru bintray wangzhannideshezhiliquchakan:

 

APIkey.png

 

kenengnizaikanbierenxiedejiaochengwenzhangshi,huifaxiantamenzaizheilihaipeizhileyige

bintray.gpg.password=your_gpg_password

zheigeyinggaishiyongyujiang bintray shangdekaiyuankutongbufabudao mavencentral cangkulideyanzhengxinxiba,fanzhengwoceshiguo,womeipeizhizheige,haishikeyizhengchangjiangbendikaiyuankushangchuanzhi bintray bingfabudao jcenter shangmianqu。

第 4 步:执行 gradle 脚本

3d开奖号455前后关系 haole,bintray gradle chajianwomenpeizhihaole,tayunxingsuoxudegezhongshuxingwomenyepeizhihaole,neimejiexiaqujiuzhishizhixingtaeryile

ruguobendiyoupeizhi gradle huanjingdehua,neimezhijiezai cmd zhongyiminglingxingdexingshizhixingjiaobenjike。

ruguomeiyoupeizhi gradle huanjing,neimemeigexiangmudegenmuluxiadouyouge gradle wenjianjia,limianyou gradle mingmingxingzhixingsuoxudewenjian,suoyikeyizhijiezai android studio de terminal lizhijieyiminglingxingdexingshizhixingduiyingjiaobenjike,ruxia:

3d开奖号455前后关系  

terminal.png

3d开奖号455前后关系  

3d开奖号455前后关系 neimeruheyunxing bintray gradle chajiandejiaobenni?zhixujiluliangtiaominglingjike:

  • gradlew install
  • gradlew bintrayUpload

gradlew install3d开奖号455前后关系 用于将项目编译、打包生成 pom,aar 等文件;

gradlew bintrayUpload3d开奖号455前后关系 用于将生成的 pom,aar 等文件上传至 bintray 仓库中;

跟编译、运行项目一样,当按顺序分别执行上述两条脚本命名时,如果运行成功,你可以在日志中看到 BUILD SUCCESSFUL3d开奖号455前后关系 信息,同样,如果脚本运行出错,那么就需要根据日志查看是哪里的问题了,通常就是第 2 步跟第 3 步出了一些问题。

另外,你还可以通过在 build 文件夹下面查看是否有生成对应的文件来判断 gradlew install 脚本有没有成功执行。然后直接在 bintray 网站你的仓库里查看文件是否有上传来判断 gradlew bintrayUpload 脚本是否有成功执行。

 

outputs.png

 

3d开奖号455前后关系  

upload.png

 

第 5 步:在 bintray 网站上将 package 发布到 JCenter

 

发布到JCenter.png

 

接下去就是最后一步了,登录你的 bintray 账号,进入你的仓库里,找到上传的开源库,然后在页面右下角找到 Add to JCenter3d开奖号455前后关系 按钮,点击进去,按照要求填写一下开源库说明,然后就静等几个小时,等收到 JCenter 发给你的审核通过邮件,那么就成功了。

neimezheishihou,nijiukeyiyukuaidezainidexinxiangmuzhongde build.gradle wenjianlizhijietongguo compile laijiangnidekaiyuankuyilaidaonixiangmuzhongjiukeyile。

小结

yishang,jiushizenmeyibubudejiangzijidekaiyuankudabaofabudao jcenter debuzhou,xiaojieyixia,wuwaihuyixiajidian:

  1. 注册 bintray 账号(可用 Github 授权登录)
  2. 在 bintray 上创建仓库,在仓库下创建 package
  3. 准备好本地需要打包发布的项目
  4. 在项目中配置 bintray gradle 插件,有两个,一个用于生成 aar,pom 等文件;一个用于将这些文件上传至 bintray 仓库;两个插件均在项目根目录下的 build.gradle 配置插件的 classPath 路径即可
  5. 在要打包发布的那个 Module 下的 build.grale 文件中配置两种插件的使用,可直接使用 apply from 配置存储在网上的脚本文件,也可将这脚本模板文件下载到本地使用
  6. apply from 必须要在 build.gradle 文件末尾,另外 exe 代码块需要在 apply from 前面,因为脚本模板文件使用的各种变量需要在 exe 块中先进行声明,赋值
  7. 理解 exe 块中的各种配置项的含义
  8. 在 Android Studio 的 Terminal 面板直接执行 gradlew install, gradlew bintrayUpload 命令来执行脚本
  9. 脚本成功执行结束后,即可在 bintray 网站中找到 Add to JCenter 按钮发布到 JCenter,然后静等邮件消息

最后,还有一篇专门记录我自己在整个过程中遇到的一些问题以及解决方法记录:


作者:请叫我大苏
链接:http://juejin.im/post/5aef06e56fb9a07aae151406
来源:掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

(责任编辑:小q)
织梦二维码生成器
顶一下
(4)
100%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
推荐内容