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.getJavaCompileProvider().get().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 29afterEvaluate { 30 publishing { 31 publications { 32 release(MavenPublication) { 33 // Depend on the release AAR 34 from project.components.release 35 36 groupId 'com.android.volley' 37 artifactId project.artifactId 38 version project.version 39 pom { 40 name = project.pomName 41 description = project.pomDescription 42 url = 'https://github.com/google/volley' 43 packaging 'aar' 44 licenses { 45 license { 46 name = "The Apache License, Version 2.0" 47 url = "http://www.apache.org/licenses/LICENSE-2.0.txt" 48 } 49 } 50 scm { 51 connection = 'scm:git:git://github.com/google/volley.git' 52 developerConnection = 'scm:git:ssh://git@github.com/google/volley.git' 53 url = 'https://github.com/google/volley' 54 } 55 developers { 56 developer { 57 name = 'The Volley Team' 58 email = 'noreply+volley@google.com' 59 } 60 } 61 } 62 63 // Also include sources and JavaDoc 64 artifact sourcesJar 65 artifact javadocJar 66 } 67 } 68 69 repositories { 70 maven { 71 url = "https://oss.sonatype.org/content/repositories/snapshots/" 72 credentials { 73 username = System.env.OSSRH_DEPLOY_USERNAME 74 password = System.env.OSSRH_DEPLOY_PASSWORD 75 } 76 } 77 } 78 } 79} 80