/**③.发布到JCenter*/ apply plugin: 'com.jfrog.bintray' apply plugin: 'com.github.dcendents.android-maven' def siteUrl = 'https://github.com/openXu/OXChart' //项目主页 def gitUrl = 'https://github.com/openXu/OXChart.git'//git仓库 group = 'com.openxu.viewlib' //groupid 一般为包名 version = '1.0.0' //版本号 install { repositories.mavenInstaller { pom { project { packaging 'aar' name 'OXViewLib'// 可选,项目名称 description 'custom chart for android'// 可选,项目描述 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 'OPEN-XU' //yourId name 'OPEN-XU' //yourName email '17373613414@yeah.net' //yourEmail } } scm { connection gitUrl developerConnection gitUrl url siteUrl } } } } } task javadoc(type: Javadoc) { options { encoding "UTF-8" charSet 'UTF-8' author true version true links "http://docs.oracle.com/javase/7/docs/api" } source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) options.encoding = "UTF-8" failOnError false // 忽略注释语法错误,如果用jdk1.8你的注释写的不规范就编译不过。 } // 生成jar包的task task sourcesJar(type: Jar) { classifier = 'sources' from android.sourceSets.main.java.srcDirs } // 生成javaDoc的jar,不需要修改。 task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir } artifacts { archives javadocJar archives sourcesJar // archives androidJavadocsJar } bintray { Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) user = properties.getProperty("bintray.user") key = properties.getProperty("bintray.apikey") configurations = ['archives'] pkg { repo = 'maven' name = 'OXViewLib' //发布到JCenter上项目名 userOrg = 'oxo1' websiteUrl = siteUrl vcsUrl = gitUrl licenses = ['Apache-2.0'] publish = true } }