Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Non-default variants are not published #64

Open
lsuski opened this issue Oct 30, 2017 · 6 comments
Open

Non-default variants are not published #64

lsuski opened this issue Oct 30, 2017 · 6 comments

Comments

@lsuski
Copy link

lsuski commented Oct 30, 2017

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
Copy link
Author

lsuski commented Oct 31, 2017

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.

@mightea
Copy link

mightea commented Nov 29, 2017

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

@lsuski
Copy link
Author

lsuski commented Nov 30, 2017

@mightea
Copy link

mightea commented Nov 30, 2017

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

@lsuski
Copy link
Author

lsuski commented Nov 30, 2017

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

@mightea
Copy link

mightea commented Nov 30, 2017

Thank you @lsuski

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants