title: How to generate multiple jar files with gradle's java plugin
body: <p>I have a multi-project gradle build using the java plugin setup as follows:</p>
  
  <pre><code>myProj/
    settings.gradle
    build.gradle
    util/
      build.gradle
  </code></pre>
  
  <p>In my util project, I would like to generate 2 jars... one for packageA and one for packageB. I'm a noob with gradle so any help here would be much appreciated. Here are my settings and gradle files:</p>
  
  <p><strong>myProj/settings.gradle</strong></p>
  
  <pre><code>include 'util'
  </code></pre>
  
  <p><strong>myProj/build.gradle</strong></p>
  
  <pre><code>subprojects {
      apply plugin: 'java'
  
      repositories {
          maven {
              url "http://mymavenurl"
          }
      }
  
      sourceSets {
          main {
              java {
                  srcDir 'src/java'
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>myProj/util/build.gradle</strong></p>
  
  <pre><code>dependencies {
      .
      .
      .
  }
  jar {
      baseName = 'packageA'
      includes = ['com/mycomp/packageA']
  }
  task packageBJar(type: Jar) {
      dependsOn classes
      includes = ['com/mycomp/packageB']
      baseName = 'packageB'
  }
  </code></pre>
  
  <p>When I try to build my project here is the output:</p>
  
  <pre><code>:util:compileJava
  :util:processResources UP-TO-DATE
  :util:classes
  :util:jar
  :util:assemble
  :util:compileTestJava UP-TO-DATE
  :util:processTestResources UP-TO-DATE
  :util:testClasses UP-TO-DATE
  :util:test
  :util:check
  :util:build
  </code></pre>
  
  <p>I would hope to see :util:packageBJar after classes, but I'm not having any luck.</p>