title: Gradle - "apply from" a ZIP dependency
body: <p>In my Gradle build script I want to import a ZIP dependency that contains static analysis configuration (CheckStyle, PMD etc.) and then "apply from" the files in that ZIP. When anyone runs the "check" task, my custom static analysis configuration should be used then.</p>
  
  <p>I've tried the somewhat convoluted solution below, but I can't get it to work. The files are retrieved and unpacked into the "config" directory, but "apply from" does not work - Gradle complains it cannot find the files; I assume this is due to "apply from" being run during the build configuration phase.</p>
  
  <p>Is there a simpler way to do this?</p>
  
  <pre><code>repositories {
      maven { url MY_MAVEN_REPO }
  }
  
  configurations {
      staticAnalysis {
          description = "Static analysis configuration"
      }
  }
  
  dependencies {
      staticAnalysis group:'my-group', name:'gradle-static-analysis-conf', version:'+', ext:'zip'
  }
  
  // Unzip static analysis conf files to "config" in root project dir.
  // This is the Gradle default location.
  task prepareStaticAnalysisConf(type: Copy) {
      def confDir = new File(rootProject.projectDir, "config")
      if (!confDir.exists()) {
          confDir.mkdirs()
      }
      from {
          configurations.staticAnalysis.collect { zipTree(it) }
      }
      into confDir
      apply from: 'config/quality.gradle'
  }
  
  check.dependsOn('prepareStaticAnalysisConf')
  </code></pre>