task sourcesJar(type: Jar) { archiveClassifier.set('sources') from android.sourceSets.main.java.srcDirs } task javadocJar(type: Jar, dependsOn: javadoc) { archiveClassifier.set('javadoc') from javadoc.destinationDir } artifacts { archives javadocJar archives sourcesJar } apply plugin: 'maven-publish' apply plugin: 'signing' group = 'com.arthenica' archivesBaseName = releaseProject version = releaseVersionName File propertiesFile = project.rootProject.file('local.properties') if (propertiesFile.exists()) { Properties properties = new Properties() properties.load(new FileInputStream(propertiesFile)) properties.each { name, value -> ext[name] = value } } ext { publishedGroupId = group artifact = releaseProject libraryName = releaseProject libraryVersion = version libraryDescription = releaseProjectDescription siteUrl = 'https://github.com/arthenica/ffmpeg-kit' gitUrl = 'https://github.com/arthenica/ffmpeg-kit.git' developerId = 'tanersener' developerName = 'Taner Sener' developerEmail = 'tanersener@gmail.com' if (Project.hasProperty('releaseGPL')) { licenseName = 'GNU General Public License version 3' licenseUrl = 'https://www.gnu.org/licenses/gpl-3.0.txt' } else { licenseName = 'GNU Lesser General Public License, Version 3' licenseUrl = 'https://www.gnu.org/licenses/lgpl-3.0.txt' } } afterEvaluate { publishing { publications { release(MavenPublication) { groupId group artifactId = libraryName version = version from components.release artifact sourcesJar artifact javadocJar pom { packaging 'aar' name = libraryName description = libraryDescription url = siteUrl licenses { license { name = licenseName url = licenseUrl } } developers { developer { id = developerId name = developerName email = developerEmail } } scm { connection = gitUrl developerConnection = gitUrl url = siteUrl } } } } repositories { maven { var releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" var snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl credentials { username ossrhUsername password ossrhPassword } } } } } signing { sign publishing.publications }