发布多module开源项目到jcenter

1.注册账号

bintray

register.png

2.根目录的build.gradle中配置

详细配置参考https://github.com/novoda/bintray-release/wiki/Configuration-of-the-publish-closure

buildscript {

    repositories {
        ...
    }
    dependencies {
        classpath 'com.novoda:bintray-release:0.9' //必选
    }
}

allprojects {
    tasks.withType(Javadoc) {//可选,javadoc乱码解决
        options{
            encoding "UTF-8"
            charSet 'UTF-8'
            links "http://docs.oracle.com/javase/7/docs/api"
        }
    }
}

//必选,配置项
ext {
    repoName='woochen'// 1. bintray上的Repository名称,不设置默认是maven
    userOrg = 'woochen'// 2. bintray.com用户名
    groupId = 'com.woochen'//3. jcenter上的路径
    uploadName = 'MyApplication'//4.Repository中项目的名称,默认是artifactId
    publishVersion = '1.0.0'//版本号 5.Repository中项目的版本号
    desc = 'Oh hi, this is a nice description for a project, right?'//6.Repository中项目的描述
    website = 'https://github.com/chewu1590/myapplication'//7.网站(不重要)
}
image.png
image.png

3.module下的build.gradle配置

apply plugin: 'bintray-release'//必选

dependencies {
    ...
}

//必选
publish {
    repoName = rootProject.repoName
    artifactId = 'myapplication-compiler'
    userOrg = rootProject.userOrg
    groupId = rootProject.groupId
    uploadName = rootProject.uploadName
    publishVersion = rootProject.publishVersion
    desc = rootProject.desc
    website = rootProject.website
    licences = rootProject.licences
}

image.png

4.上传项目

详情参考https://github.com/novoda/bintray-release
在teminal中执行以下代码

gradlew clean build bintrayUpload -PbintrayUser=woochen -PbintrayKey=xxxxxxxxxxxxxxxx -PdryRun=false

注意:不翻墙的情况下可能连接超时导致上传失败,失败后重新执行上面代码即可

5.发布项目

image.png

6.审核中可以使用私有仓库临时依赖

image.png

在根目录的build.gradle中添加

allprojects {
    repositories {
        maven { url 'https://dl.bintray.com/woochen/woochen' }
    }
}

7.依赖项目

compile 'com.woochen:myapplication-compiler:1.0.0'

感谢

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。