config/android-maven-publication.gradle
author Da Risk <da_risk@geekorum.com>
Fri, 08 May 2020 21:33:19 -0400
changeset 1 831cffa9c991
child 6 99ad8c14fec2
permissions -rw-r--r--
source import

/**
 * This configuration allows to publish android libraries into a maven repository.
 * You need to define in your build.gradle the following variables :
 * version = "1.0"                // the version of your projects
 * ext.artifactId="geny-widgets"  // the maven artifact id
 * Use ./gradlew tasks to see the name of the publishing tasks.
 */
if (plugins.hasPlugin("com.android.library")) {

    apply plugin: 'maven-publish'

    if (!project.ext.properties.containsKey("artifactId")) {
        ext.artifactId = project.name
    }

    publishing {
        publications {
            projectRelease(MavenPublication) {
                artifactId project.artifactId
                artifact "build/outputs/aar/${project.archivesBaseName}-release.aar"
            }

            projectSnapshot(MavenPublication) {
                artifactId project.artifactId
                artifact "build/outputs/aar/${project.archivesBaseName}-debug.aar"
                version getVersion() + "-SNAPSHOT"
            }
        }
    }
}