Gradle plugin for publishing Android (AAR) libraries using Maven Publish plugin.
- Gradle 5.3+
- Android Gradle Plugin 3.3+
plugins {
id "com.android.library"
id "com.github.technoir42.aar-publish" version "1.0.4"
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.
The plugin registers the following SoftwareComponent
s:
components.android
- for the default variant set usingandroid.defaultPublishConfig
which isrelease
by default.components.android${capitalizedVariantName}
- for all variants, e.g.androidMyFlavorRelease
if variant name ismyFlavorRelease
.
Changing the default variant:
android {
defaultPublishConfig "myFlavorRelease"
productFlavors {
myFlavor {
}
}
}
Publishing a specific variant:
publishing {
publications {
maven(MavenPublication) {
afterEvaluate {
from components.androidMyFlavorRelease
}
}
}
}
Sources and Javadoc are published by default but you can disable publishing either of them using the following DSL:
aarPublishing {
publishJavadoc = false
publishSources = false
}
- Dokka is not currently supported. It might work with some extra configuration.
- Kotlin Multiplatform projects are not supported.
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.