config/android-maven-publication.gradle
changeset 1 831cffa9c991
child 6 99ad8c14fec2
equal deleted inserted replaced
0:fef46dce2812 1:831cffa9c991
       
     1 /**
       
     2  * This configuration allows to publish android libraries into a maven repository.
       
     3  * You need to define in your build.gradle the following variables :
       
     4  * version = "1.0"                // the version of your projects
       
     5  * ext.artifactId="geny-widgets"  // the maven artifact id
       
     6  * Use ./gradlew tasks to see the name of the publishing tasks.
       
     7  */
       
     8 if (plugins.hasPlugin("com.android.library")) {
       
     9 
       
    10     apply plugin: 'maven-publish'
       
    11 
       
    12     if (!project.ext.properties.containsKey("artifactId")) {
       
    13         ext.artifactId = project.name
       
    14     }
       
    15 
       
    16     publishing {
       
    17         publications {
       
    18             projectRelease(MavenPublication) {
       
    19                 artifactId project.artifactId
       
    20                 artifact "build/outputs/aar/${project.archivesBaseName}-release.aar"
       
    21             }
       
    22 
       
    23             projectSnapshot(MavenPublication) {
       
    24                 artifactId project.artifactId
       
    25                 artifact "build/outputs/aar/${project.archivesBaseName}-debug.aar"
       
    26                 version getVersion() + "-SNAPSHOT"
       
    27             }
       
    28         }
       
    29     }
       
    30 }