title: Dynamically add JAR to Gradle dependencies
body: <p>Currently, my build.gradle has a dependency on an external library built with Ant. To accomplish building the library, I followed the advice <a href="http://www.kellyrob99.com/blog/2011/09/18/using-gradle-to-bootstrap-your-legacy-ant-builds/" rel="nofollow">here</a> and created a task which builds the external library, and copies it to the libs/ folder.</p>
  
  <p>The task is called as part of a <code>dependency</code>:</p>
  
  <p><strong>build.gradle</strong></p>
  
  <pre><code>dependencies {
      compile fileTree('libs') {
          include '*.jar'
          builtBy 'myTask'
      }
  }
  
  task myTask (type: GradleBuild) { GradleBuild antBuild -&gt;
      antBuild.buildFile('external-stub.gradle')
      antBuild.tasks = ['clean', 'ivy.check', 'ivy.download', 'ivy.task', 'ivy',
      'init', 'mergeCode', 'compile', 'jar', 'copyJarsToProject']
  }
  </code></pre>
  
  <p>However, when the compile actually runs, the library I just built and copied in is not included in the dependencies, as evidenced by a whole lot of compilation errors.</p>
  
  <p>Am I including the library the wrong way?</p>
  
  <p>The full build.gradle and associated files are over at Github, and I've linked to the specific commit I'm having issues with: <a href="https://github.com/MinimalBible/MinimalBible/tree/77c797d4f1621511f659557397f597fd0843a6f6/MinimalBible" rel="nofollow">Source Repository</a></p>