title: Gradle projects depending on artifacts created by sibling projects
body: <p>I have this Gradle setup with four projects, a parent with three children, where a Java Servlet JSON 'backend' is built into a war-file, and then a static HTML5 'frontend' consuming this is built into a zip. Both these "installs" their artifcats to the local maven repo.</p>
  
  <p><strong>The third sibling project 'merger' depends on these two artifacts, to build a "merged" war by simply "zipping them together".</strong></p>
  
  <p>However, once I had this up and running as intended, I obviously had to <em>test the bootstrap-scenario by deleting the artifacts from the local repo.</em></p>
  
  <p>Now I suddenly get "Artifact 'no.company:frontend:1.0-SNAPSHOT@zip' not found".</p>
  
  <p>Is it not possible to depend on artifacts which <strong>will be produced</strong> by the current build?</p>
  
  <p><em>Edit:</em></p>
  
  <p>Based on another idea (and the reply from Peter discouraging this Maven logic), this version looks promising, not traversing Maven (note: it works!):</p>
  
  <pre><code>// ## From frontend's build.gradle:
  task zipFrontend(dependsOn: 'buildFrontend',  type: Zip) {
      from ('dist/')
  }
  
  // ## From backend's build.gradle:
  apply plugin: 'war'
  
  // ## From merger's build.gradle:
  task mergeFrontAndBack(dependsOn: [':backend:war', 
                                     ':frontend:zipFrontend'], type: War) {
      from zipTree(project(':frontend').tasks['zipFrontend'].archivePath)
      from zipTree(project(':backend').tasks['war'].archivePath)
      destinationDir(buildDir)
  }
  </code></pre>
  
  <p><em>Edit 2:</em></p>
  
  <p>Based upon Peter's comment about not reaching into siblings' project structure and his concrete suggestions, here's the resulting piece (note: it works!):</p>
  
  <pre><code>// ## From frontend's build.gradle:
  task zipFrontend(dependsOn: 'buildFrontend',  type: Zip) {
      from ('dist/')
  }
  configurations { zip }
  artifacts { zip zipFrontend }
  
  // ## From backend's build.gradle:
  apply plugin: 'war'
  configurations { jsonOnlyWar }
  artifacts { jsonOnlyWar war }
  
  // ## From merger's build.gradle:
  configurations { merge }
  dependencies {
      merge project(path: ':backend', configuration: 'jsonOnlyWar')
      merge project(path: ':frontend', configuration: 'zip')
  }
  task mergeFrontAndBack(dependsOn: configurations.merge, type: War) {
      from { configurations.merge.collect { zipTree(it) } }
      destinationDir(buildDir)
  }
  </code></pre>