aar-publish-plugin

Introduction: Gradle plugin for publishing AAR libraries
More: Author   ReportBugs   
Tags:

Gradle plugin for publishing Android (AAR) libraries using Maven Publish plugin.

Requirements

  • Gradle 5.3+
  • Android Gradle Plugin 3.3+

Usage

plugins {
    id "com.android.library"
    id "com.github.technoir42.aar-publish" version "1.0.0"
    id "maven-publish"
}

publishing {
    publications {
        maven(MavenPublication) {
            from components.android
        }
    }
}

To learn how to configure publications and repositories refer to the documentation for Maven Publish plugin.

Variants

The plugin registers the following SoftwareComponents:

  • components.android - for the default variant set using android.defaultPublishConfig which is release by default.
  • components.android${capitalizedVariantName} - for all variants, e.g. androidMyFlavorRelease if variant name is myFlavorRelease.

Changing the default variant:

android {
    defaultPublishConfig "myFlavorRelease"

    productFlavors {
        myFlavor {
        }
    }
}

Publishing a specific variant:

publishing {
    publications {
        maven(MavenPublication) {
            afterEvaluate {
                from components.androidMyFlavorRelease
            }
        }
    }
}

Plugin configuration

Sources and Javadoc are published by default but you can disable publishing either of them using the following DSL:

aarPublishing {
    publishJavadoc = false
    publishSources = false
}

License

Copyright 2019 Sergey Chelombitko

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Support Me
Apps
About Me
Google+: Trinea trinea
GitHub: Trinea