android-maven-gradle-plugin
android-maven-gradle-plugin copied to clipboard
Non-default variants are not published
I don't know if this is plugin issue or AGP but with plugin 2.0 and AGP 3.0.0 only single variant is published.
publishNonDefault=true
does not work anymore because AGP should automatically publish all variants and ignores this setting.
Based on this https://issuetracker.google.com/issues/68492586 it won't be fixed in AGP. I've used https://github.com/wupdigital/android-maven-publish plugin to achieve this.
@isuski I could not get the plugin to work, could you share your config?
@mightea you want config for https://github.com/wupdigital/android-maven-publish ?
Yes, that would be awesome, I could not get gradle to work properly with the publish plugin
This config creates task mavenAll which uploads all variants to internal maven repository
publishing.publications {
"mavenAll"(MavenPublication) {
def addAll=true
pom.packaging = 'aar'
android.libraryVariants.all { v ->
if (addAll) {
addAll=false
from components.android
setArtifacts([])
}
artifact(tasks."bundle${v.name.capitalize()}") {
classifier v.name
}
}
}
}
publishing.repositories {
maven {
url project.version.endsWith('-SNAPSHOT')?"https://yourmavenrepo.com/snapshots": "https://yourmavenrepo.com/release"
credentials {
username = "some_user_able_to_upload"
password = "password"
}
}
}
Thank you @lsuski