ligi ligi - 1 year ago 57
Android Question

maven publish android.library with aar and source jar

can somebody give me a hint on how to use the maven-publish gradle plugin to publish a project with aar and source jar? I am able to do this with the old maven plugin - but I would like to use the new maven-publish plugin

Answer Source

Here's a sample using the new maven-publish plugin.

apply plugin: 'maven-publish'

task sourceJar(type: Jar) {
    classifier "source"

publishing {
    publications {
        bar(MavenPublication) {
            groupId ''
            artifactId 'bar'
            version '0.1'
    repositories {
        maven {
            url "$buildDir/repo"

Publish with ./gradlew clean build publish