apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' version = VERSION_NAME group = GROUP task androidJavadocs(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) android.libraryVariants.all { variant -> if (variant.name == 'release') { owner.classpath += variant.javaCompileProvider.get().classpath } } exclude '**/R.html', '**/R.*.html', '**/index.html' } task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { archiveClassifier.set('javadoc') from androidJavadocs.destinationDir } task androidSourcesJar(type: Jar) { archiveClassifier.set('sources') from android.sourceSets.main.java.srcDirs } afterEvaluate { project -> publishing { publications { release(MavenPublication) { from components.release artifact androidSourcesJar artifact androidJavadocsJar groupId = GROUP artifactId = POM_ARTIFACT_ID version = VERSION_NAME pom { name = POM_NAME packaging = POM_PACKAGING description = POM_DESCRIPTION url = POM_URL scm { url = POM_SCM_URL connection = POM_SCM_CONNECTION developerConnection = POM_SCM_DEV_CONNECTION } licenses { license { name = POM_LICENCE_NAME url = POM_LICENCE_URL } } developers { developer { id = POM_DEVELOPER_ID name = POM_DEVELOPER_NAME email = POM_DEVELOPER_EMAIL } } } } } } if (JavaVersion.current().isJava8Compatible()) { allprojects { tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') } } } } // Bintray Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) bintray { user = properties.getProperty("BINTRAY_USER") key = properties.getProperty("BINTRAY_APIKEY") publications = ['release'] pkg { name = GROUP + ":" + POM_ARTIFACT_ID desc = POM_DESCRIPTION userOrg = properties.getProperty("BINTRAY_USER_ORG") repo = properties.getProperty("BINTRAY_REPO") websiteUrl = POM_URL issueTrackerUrl = POM_URL + "/issues" vcsUrl = POM_URL + ".git" licenses = [POM_LICENCE] publish = true publicDownloadNumbers = true version { desc = POM_DESCRIPTION vcsTag = "v" + VERSION_NAME gpg { sign = true // Determines whether to GPG sign the files. The default is false passphrase = properties.getProperty("BINTRAY_GPG_PASSWORD") // Optional. The passphrase for GPG signing' } // Optional configuration for Maven Central sync of the version mavenCentralSync { sync = true //[Default: true] Determines whether to sync the version to Maven Central. user = properties.getProperty("SONATYPE_NEXUS_USERNAME") //OSS user token: mandatory password = properties.getProperty("SONATYPE_NEXUS_PASSWORD") //OSS user password: mandatory close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually. } } } }