发布AAR到jcenter仓库

1.在local.properties下添加:
  bintray.user = ******
  bintray.apikey = 45********1f7f5779f008*******aa610c***
2.在build.gradle添加
1).添加插件
  apply plugin: 'com.github.dcendents.android-maven'
  apply plugin: 'com.jfrog.bintray'

2).定义版本
  version = "1.0.0"
  
  //上面添加顶部 下面添加底部
  
3).定义相关网站
  def siteUrl = 'https://github.com/xxxxx/xxxx'    // project homepage
  def gitUrl = 'https://github.com/xxxxx/xxxx.git' // project git

4).定义Group
//第一部分就是group,第二部分是name, 第三部分是上面定义的version。
group = "xxx.xxxxx.xxxxx:1.0.0"

5). 定义pom并打包aar
install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'
                name 'xxxx'
                url siteUrl
                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id 'xxxxx'
                        name 'xxxxx'
                        email '1825203636@qq.com'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

7). 打包javadocjar和sourcejar
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
}

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 = "xxxxx"
        // #CONFIG# project name in jcenter
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true
    }

}




转载于:https://my.oschina.net/spoon2014/blog/647601

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值