// 这里添加下面两行代码。 apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' // 定义两个链接,下面会用到。 def siteUrl = 'http://www.yanyis.space/yanyi/dateselect' // 项目主页。 def gitUrl = 'http://www.yanyis.space/yanyi/dateselect.git' // Git仓库的url。 group = "com.yanyi.benyanyi"// 唯一包名,比如compile 'com.ansen.http:okhttpencapsulation:1.0.1'中的com.ansen.http就是这里配置的。 version = "1.0.1"//项目引用的版本号,比如compile 'com.ansen.http:okhttpencapsulation:1.0.1'中的1.0.1就是这里配置的。 install { repositories.mavenInstaller { // This generates POM.xml with proper parameters pom { project { packaging 'aar' // Add your description here name 'multi-format 1D/2D barcode image processing use zxing.' 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 'benyanyi' //填写的一些基本信息 name 'benyanyi' email 'git@yanyi.red' } } scm { connection gitUrl developerConnection gitUrl url siteUrl } } } } } 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 = "DateSelect" name = "DateSelect" //发布到JCenter上的项目名字 websiteUrl = siteUrl vcsUrl = gitUrl licenses = ["Apache-2.0"] publish = true } } javadoc { //jav doc采用utf-8编码否则会报“GBK的不可映射字符”错误 options { encoding "UTF-8" charSet 'UTF-8' } } //gradlew bintrayUpload terminal中输入