android-maven-gradle-plugin icon indicating copy to clipboard operation
android-maven-gradle-plugin copied to clipboard

Non-default variants are not published

Open lsuski opened this issue 7 years ago • 6 comments

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.

lsuski avatar Oct 30 '17 13:10 lsuski

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.

lsuski avatar Oct 31 '17 08:10 lsuski

@isuski I could not get the plugin to work, could you share your config?

mightea avatar Nov 29 '17 14:11 mightea

@mightea you want config for https://github.com/wupdigital/android-maven-publish ?

lsuski avatar Nov 30 '17 09:11 lsuski

Yes, that would be awesome, I could not get gradle to work properly with the publish plugin

mightea avatar Nov 30 '17 09:11 mightea

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"
        }
    }
}

lsuski avatar Nov 30 '17 10:11 lsuski

Thank you @lsuski

mightea avatar Nov 30 '17 10:11 mightea