美文网首页
发布多module开源项目到jcenter

发布多module开源项目到jcenter

作者: woochen123 | 来源:发表于2019-04-18 14:33 被阅读0次

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'

感谢

相关文章

网友评论

      本文标题:发布多module开源项目到jcenter

      本文链接:https://www.haomeiwen.com/subject/nlnzwqtx.html