title: Gradle explode a zip into a buildDir
body: <p>My project has a remote dependency which is really just a zip of certain files, which needs to be unzipped somewhere, so that the build can generate new java sources from the files.  (I'm speaking generically to focus on the core problem and not on the specifics)</p>
  
  <p>I wouldn't expect this to be so hard, but I've been unable to get it working.  Here's what I've created:</p>
  
  <p>I defined a new configuration:</p>
  
  <pre><code>configurations {
      newConf
  }
  </code></pre>
  
  <p>Later, I've defined a single dependency for this confiuguration.  It resolves to the zip file I need to explode:</p>
  
  <pre><code>dependencies {
      newConf "group:name:version@zip"
  }
  </code></pre>
  
  <p>So far this all smells correct to me, though if anybody disagrees, I'm listening.</p>
  
  <p>Lastly I need to define a task that explodes the zip into a directory, which then becomes the input for a later code-generation command.</p>
  
  <pre><code>task explodeModel {
      description = "unzip model into the specified 'modelSrc' directory"
  
      //input is a "files" collection (usually just one:  the zip)
      //output is the specified modelSrc dir
  
      File modelSrc = new File("$buildDir/modelSrc")
      outputs.files modelSrc
  
      doLast {
          configurations.newConf.allArtifacts.each { artifact -&gt; println artifact }
      }
  
  }
  </code></pre>
  
  <p>Obviously doLast isn't unzipping anything just yet, I'm just trying to get an absolute path to the zipfile itself, and thats where I'm stuck.  I have no idea how to get a path to the file so I can unzip it.  Any help?</p>
  
  <p>Many thanks</p>