title: How do I produce a ZIP of my source using Gradle?
body: <p>I'm converting a relatively small project from Ant to Gradle. I expect to reduce the number of lines in the build script by approximately 75%!</p>
  
  <p>One thing the Ant build does is to produce a source ZIP (i.e. a ZIP of the whole project, with certain bits removed - ./build, various Eclipse folders, etc.) Whilst migrating this to Gradle, I decided to use an "inclusive" approach, rather than an "exclusive" approach so that things don't get included by accident later on.</p>
  
  <p>I'd like to be able to grab the source code and resources for all of the source sets without having to list the directories explicitly, but I can't get it working.</p>
  
  <p>Here's what I have so far (doesn't even run!):</p>
  
  <pre><code>task srcZip(type: Zip) {
      classifier = 'src'
      from projectDir
      include {
          sourceSets.collect {
              it.allSource.asPath
          }
      }
  }
  </code></pre>
  
  <p>The ZIP file should end up with folders 'src/main/java/...', 'src/main/resources/...', 'src/test/java/...', etc., and I shouldn't need to re-visit this task when I add more source sets later on.</p>
  
  <p>Thanks in advance!</p>