title: Combine two modules into a single module for publishing
body: <p>I'd like to split up a module (<code>library</code>) in two modules (<code>lib-core</code>) and (<code>lib-extras</code>).<br>
  Currently, I'm publishing with artifact id <code>library</code>, and I want to keep this functionality as well. I also want to publish the two separate modules.</p>
  
  <p>For example:</p>
  
  <blockquote>
    <ul>
    <li>lib-core
    <ul>
    <li>class A</li>
    </ul></li>
    <li>lib-extras
    <ul>
    <li>class B</li>
    </ul></li>
    <li>library<br>
    *(empty, depends on <em>lib-core</em> and <em>lib-extras</em>)*</li>
    </ul>
  </blockquote>
  
  <p>What I want to achieve is when publishing these modules, I get an archive <code>lib-core</code> containing class <code>A</code>, and archive <code>lib-extras</code> containing class <code>B</code>, and an archive <code>library</code>, containing both classes <code>A</code> and <code>B</code>.</p>
  
  <p><strong>Is this possible using gradle?</strong></p>
  
  <p>This is my uploadArchives task, which is applied in all three modules:</p>
  
  <pre><code>apply plugin: 'maven'
  apply plugin: 'signing'
  
  def sonatypeRepositoryUrl
  if (isRelease == 'true') {
      sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
  } else {
      sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
      version = VERSION_NAME + '-SNAPSHOT'
  }
  
  afterEvaluate { project -&gt;
      uploadArchives {
          repositories {
              mavenDeployer {
                  beforeDeployment { MavenDeployment deployment -&gt; signing.signPom(deployment) }
  
                  pom.artifactId = POM_ARTIFACT_ID
  
                  repository(url: sonatypeRepositoryUrl) {
                      authentication(userName: nexusUsername, password: nexusPassword)
                  }
  
                  pom.project {
                      name POM_NAME
                      packaging POM_PACKAGING
                      description POM_DESCRIPTION
                      url POM_URL
  
                      scm {
                          url POM_SCM_URL
                          connection POM_SCM_CONNECTION
                          developerConnection POM_SCM_DEV_CONNECTION
                      }
  
                      licenses {
                          license {
                              name POM_LICENCE_NAME
                              url POM_LICENCE_URL
                              distribution POM_LICENCE_DIST
                          }
                      }
  
                      developers {
                          developer {
                              id POM_DEVELOPER_ID
                              name POM_DEVELOPER_NAME
                          }
                      }
                  }
              }
          }
      }
  
      signing {
          required { isRelease == 'true' &amp;&amp; gradle.taskGraph.hasTask("uploadArchives") }
          sign configurations.archives
      }
  
      task androidJavadocs(type: Javadoc) {
          source = android.sourceSets.main.java
      }
  
      task androidJavadocsJar(type: Jar) {
          classifier = 'javadoc'
          from androidJavadocs.destinationDir
      }
  
      task androidSourcesJar(type: Jar) {
          classifier = 'sources'
          from android.sourceSets.main.java.sourceFiles
      }
  
      artifacts {
          archives androidSourcesJar
          archives androidJavadocsJar
      }
  }
  </code></pre>