快捷使用JitPack发布你的Github开源库
参考:http://my.oschina.net/aibenben/blog/598217
以前在github上发布开源库大家都需要把这个库down下来,然后以工程包的形式引入,但是android studio出来后,引用了Gradle来管理依赖,方便,高效。
先看怎么用,最后讲怎么做。。
怎么用:

当我们使用JitPack发布你的Github开源库的时候第一步:记得是在你的root project 的build.gradle添加jitpack仓库, 看下图就知道什么是所谓的root project的build.gradle了。
maven{
url"https://jitpack.io"
}

接着第二步:
compile'com.github.veidy:veidyLibrary:0.1'

怎么做:
1.我建议第一步就是首页在github上先新建一个仓库
(怎么创建。。这就不讲了吧。。。)

2.第二步那就是clone到本地喽。。。
(这也不用讲了吧。。。。是真没截图,所以 没图了。。。就是那一行命令嘛。。。git clone https://github.com/veidy/veidyLibrary.git)
3.第三步 在本地创建一个新的项目,目录在这个仓库里。准确的说是创建一个项目(sample),然后在项目里面创建一个android library(VeidyLibrary)

接下来是重点:
1.In your root build.gradle(引用 官方原文了。。。)添加下面一行
buildscript{dependencies{classpath'com.github.dcendents:android-maven-gradle-plugin:1.3'

2.In your library/build.gradle add:(引用 官方原文了。。。)添加下面两行
apply plugin:'com.github.dcendents.android-maven'group='com.github.YourUsername'

3.那就是提交这个项目到github上面。。。。
(怎么提交就不讲了吧...git用的还不怎么熟悉,像提交这玩意我肯定会用git gui来干了。。)
提交成功后,如下图:

最后一个重点:这个时候我们需要创建releases版本 点击releases后

没有过那就是新建。。,像我这新建个0.1,这随便自己来了

最后Publish release 搞定! 以后你每提交一个项目到github,就可以重新创建一个release版本。。。
再回过头,看怎么用 在别的项目里面来引入这个包试一下


这里第一次引入需要稍等一会儿。。。这正常了,因为。。。大家都知道
最后有没有引入成功呢,我们可以验证一下,我在VeidyLibrary里面封装了一个方法Test()

然后我在项目里面看能不能直接调这个方法。

OK,完美结束。