title: Gradle equivalent of Maven Assembly
body: <p>As long as Gradle has been around, I'd have thought this was well documented, but I'm struggling. Sorry if this is obvious to everyone else.</p>
  
  <p>I have a multi-project build setup with maven, I'm setting up gradle for comparison. </p>
  
  <p>Project A produces a jar file, Project B produces a war file (and depends on the jar from A). Project C I want to create an assembly, i.e. a zip file. The zip file should contain the contents of a directory within project C, the war file from Project B, and the unpacked contents of a tomcat assembly pulled down from Archiva.</p>
  
  <p>The problem I'm having is that when gradle evaluates the build.gradle files, it fails because it can't find the war file - which is no surprise, the war file hasn't been built yet.</p>
  
  <p>So, how do I express the dependency on the war file in such a way that it doesn't cause the failure during evaluation?</p>
  
  <pre><code>apply plugin: 'distribution'
  
  description = """E2am Assembly"""
  
  project(':assembly') {
      dependencies {
          compile project(':webapps/e2am')
      }
  }
  
  
  dependencies {
      compile group: 'com.e2open.platform', name: 'e2am', version:'9.0-SNAPSHOT', ext:'war'
      compile group: 'com.e2open.platform.third-party.tomcat', name: 'tomcat-assembly',version:'7.0.42-1002', classifier:'bin', ext:'zip'
  }
  
  task explodeTomcat(type: Copy, dependsOn: ':webapps/e2am:install'){
  
     configurations.compile.filter { it.toString().endsWith(".zip") }.each{
        from zipTree(it)
     }
     into 'TomcatUnpacked'
  
     configurations.compile.filter { it.toString().endsWith(".war") }.each{
        from it
     }
     into 'war'
  
  }
  
  distributions {
      main {
          baseName = 'e2am-assembly'
          contents {
              from { 'tomcat' }
              from { 'TomcatUnpacked' }
              from { 'war' }
          }
      }
  }
  
  
  distZip.dependsOn explodeTomcat
  install.dependsOn distZip
  </code></pre>
  
  <p>Also, the top level project applies the 'java' and 'maven' plugin to all sub projects.</p>
  
  <p>The error is:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * Where:
      Build file '/kwork/wkcopy/e2amA/assembly/build.gradle' line: 25
  
  * What went wrong:
      A problem occurred evaluating project ':assembly'.
      &gt; Could not resolve all dependencies for configuration ':assembly:compile'.
         &gt; Could not find com.e2open.platform:e2am:9.0-SNAPSHOT.
           Required by:
               com.e2open.platform:assembly:9.0-SNAPSHOT
  </code></pre>
  
  <p>Can someone point me to documentation or a discussion that gets me farther down the road? Thanks!</p>