1apply plugin: 'maven-publish' 2 3task sourcesJar(type: Jar) { 4 classifier = 'sources' 5 from android.sourceSets.main.java.srcDirs 6} 7 8task javadoc(type: Javadoc) { 9 source = android.sourceSets.main.java.srcDirs 10 classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 11} 12 13afterEvaluate { 14 javadoc.classpath += files(android.libraryVariants.collect { variant -> 15 variant.getJavaCompile().classpath.files 16 }) 17} 18 19task javadocJar(type: Jar, dependsOn: javadoc) { 20 classifier = 'javadoc' 21 from javadoc.destinationDir 22} 23 24artifacts { 25 archives javadocJar 26 archives sourcesJar 27} 28 29publishing { 30 publications { 31 library(MavenPublication) { 32 groupId 'com.android.volley' 33 version project.version 34 pom { 35 name = 'Volley' 36 url = 'https://github.com/google/volley' 37 packaging 'aar' 38 licenses { 39 license { 40 name = "The Apache License, Version 2.0" 41 url = "http://www.apache.org/licenses/LICENSE-2.0.txt" 42 } 43 } 44 scm { 45 connection = 'scm:git:git://github.com/google/volley.git' 46 developerConnection = 'scm:git:ssh://[email protected]/google/volley.git' 47 url = 'https://github.com/google/volley' 48 } 49 developers { 50 developer { 51 name = 'The Volley Team' 52 email = '[email protected]' 53 } 54 } 55 } 56 57 // Release AAR, Sources, and JavaDoc 58 artifact sourcesJar 59 artifact javadocJar 60 } 61 } 62 63 repositories { 64 maven { 65 url = "https://oss.sonatype.org/content/repositories/snapshots/" 66 credentials { 67 username = System.env.OSSRH_DEPLOY_USERNAME 68 password = System.env.OSSRH_DEPLOY_PASSWORD 69 } 70 } 71 } 72} 73