当用android studio开发时,肯定会compile 各种组件,这时候我们肯定也想自己创建个module丢到jcenter上面去,下面就教你们怎么玩。

这里推荐bintray:
1.首先https://bintray.com/ 注册账号,可以用github同步,别告诉我你没有github账号。
2:创建好自己要上传的module。
3:写好build.gradle脚本。

全局build.gradle clashpath添加如下:

        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

module build.gradle 脚本内容:
1.添加plugin:

apply plugin: 'com.github.dcendents.android-maven'apply plugin: 'com.jfrog.bintray'

2.version版本号

version = "0.0.5"

3.添加url 与 groupId
url一般用github地址

def siteUrl = 'https://github.com/dashentao1989/JcenterView'                        // #CONFIG# // project homepagedef gitUrl = 'https://github.com/dashentao1989/JcenterView.git'                     // #CONFIG# // project gitgroup = "com.quanjiaview"  

4.pom中填入基本信息

install {    repositories.mavenInstaller {        // This generates POM.xml with proper parameters        pom {            project {                packaging 'aar'                name 'Less Code For Android'                                   // #CONFIG# // project title                url siteUrl                // Set your license                licenses {                    license {                        name 'The Apache Software License, Version 2.0'                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'                    }                }                developers {                    developer {                        id 'dashentao'                                           // #CONFIG# // your user id (you can write your nickname)                        name 'dashentao'                                       // #CONFIG# // your user name                        email 'dashentao1989@gmail.com'                               // #CONFIG# // your email                    }                }                scm {                    connection gitUrl                    developerConnection gitUrl                    url siteUrl                }            }        }    }}

6.生成javadocJar,sourcesJar

task sourcesJar(type: Jar) {    from android.sourceSets.main.java.srcDirs    classifier = 'sources'}task javadoc(type: Javadoc) {    source = android.sourceSets.main.java.srcDirs    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))}task javadocJar(type: Jar, dependsOn: javadoc) {    classifier = 'javadoc'    from javadoc.destinationDir}artifacts {    archives javadocJar    archives sourcesJar}

7.拿到api key
api key在bintray中拿到,如下图:

api key放在local.properties中:

bintray.apikey=82b67d9208d7dacb6b90e424b7fbd04c9bc76327

同时还得输入user:

bintray.user=dashentao1989

然后在build.gradle中通过脚本获取这两个值:

Properties properties = new Properties()properties.load(project.rootProject.file('local.properties').newDataInputStream())bintray {    user = properties.getProperty("bintray.user")    key = properties.getProperty("bintray.apikey")    configurations = ['archives']    pkg {        repo = "maven"        name = "quanjiaview"                                                 // #CONFIG# project name in jcenter        websiteUrl = siteUrl        vcsUrl = gitUrl        licenses = ["Apache-2.0"]        publish = true    }}

完成脚本之后,就可以upload了

在terminal中执行命令行

./gradlew bintrayUpload

然后在Bintray中点击 add to jcenter。

再然后会出现一个申请页面,填写一些commit信息,点击Send发送按钮后等待Bintray后台审核,一般要半天左右,耐心等待。

等邮件收到的时候,就表明.arr可以complie下来了,具体邮件内容如下:

Bintray (bintray) has sent you a direct message from Bintray:Your request to include your package /dashentao1989/maven/quanjiaview in Bintray's JCenter has been approved.

当收到邮件之后,可以输入网址https://jcenter.bintray.com/ + 你的groupId,例如:https://jcenter.bintray.com/com/quanjiaview/如果出现如下页面说明.arr可以用。

然后你就可以用compile进行下载了

compile 'com.quanjiaview:quanjiaview:0.0.5'

祝:玩的开心。

更多相关文章

  1. android 傻瓜式 MultiDex 插件,从此再也不用担心方法数问题!
  2. 让Python在Android系统上飞一会儿
  3. Android(安卓)5.1编译大于2G的OTA包是会出 Android(安卓)Overflo
  4. 对 android apk 进行重新签名操作
  5. Android编译系统中的Kconfig,Makefile,.config编译系统浅析
  6. AndroidR系统启动详细分析-学习笔记
  7. 编译Windows版Android(安卓)Emulator(Cupcake)
  8. android运行模拟器脚本(批处理)
  9. android 邮件开发(javax.mail)

随机推荐

  1. Android开发系列教程——目录
  2. Android studio升级3.0.1之后原项目签名
  3. [置顶] Android(安卓)SQlite使用实践Demo
  4. build command in android
  5. android读取SD卡下面所有的TXT文件名,list
  6. android 简单比较 两个图片是否一致
  7. Android P 隐藏Setting主页面Suggestion
  8. android 內存等使用情況
  9. android中使用intent传输值
  10. Android(安卓)检测是否有ROOT权限