Q:

How to package subproject libraries with root library

I have a few Android library projects that I host on a maven repository.  All of these libraries are subprojects of a root library project.  I'm trying to make it so my root library project can gather the sources and outputs of all the subprojects to be distributed as a single library.
I have the root project and subprojects successfully publishing to maven, but when the root project is published, it is excluding the subprojects when packaging the aar.
Structure:
Root
  \--subproject1
  \--subproject2

Here is my gradle snippet:
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':subproject1')
    compile project(':subproject2')
}

configurations {
    published
}

subprojects.each { subproject -> evaluationDependsOn(subproject.path)}
task sourceJar(type: Jar) {
    dependsOn subprojects.tasks['sourceJar']
    subprojects.each { subproject ->
        from subproject.configurations.published.allArtifacts.files.collect {
            zipTree(it)
        }
    }
    classifier "sources"
}

artifactoryPublish {
    dependsOn sourceJar
}

artifacts {
    published sourceJar
}

Because of the dependsOn in sourceJar, my subprojects get published to my maven repository at the same time as this root project (which is what I want and fine).  The root project does not however include these subprojects as part of the root AAR when packaging.
How do I configure my root project to package all subprojects inside it?

A:

I was able to find a solution using this library from Github:
https://github.com/adwiv/android-fat-aar
The library will allow you to embed subprojects when packaging the final library, like so (notice the embedded notation):
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    embedded project(':subproject1')
    embedded project(':subproject2')
}

