发布开源库到 JitPack.io + jcenter

来源:互联网 发布:签证邀请函知乎 编辑:程序博客网 时间:2024/06/03 17:37

JitPack.io

参考:
Android 写自己的开源库,发布到 JitPack.io
JitPack官方文档 上传Android库

JitPack官网

示例:发布ClearEditText到itPack.io

过程:

  • 创建project,创建module(app+library),module library里面有我们的ClearEditText
  • 将项目发布到github上,并设置realease
  • 打开JitPack官网,输入该项目的url,look up–>get it。

完成,按照浏览结果配置library。

详细步骤

ClearEditTextLibrary是库moludle
If using Gradle 3.0 or later:
(1) In your root build.gradle:

buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:2.3.0'        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'  // Add this line    }}

(2) In your library/build.gradle add:

apply plugin: 'com.github.dcendents.android-maven'group='com.github.s1168805219'

其中s1168805219是我在github上的userName
(3) Create a GitHub release or add a git tag.
打开该project在github上的地址—>release–>create a new release–>填写相应的信息即可
这里写图片描述

这里写图片描述

这里写图片描述

结果是:
这里写图片描述

(4)进入JitPack官网搜索你的库,查看如何引用

搜索是输入它的github上的url即可

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {    repositories {        ...        maven { url 'https://jitpack.io' }    }}

Step 2. Add the dependency

dependencies {    compile 'com.github.User:Repo:Tag'}

这里写图片描述

这里写图片描述

原创粉丝点击