title: Gradle Project: Copy Dependencies to Build Directory
body: <p>How do I copy my project's dependencies to the build directory?</p>
  
  <p>This is a very common question. I've searched and found many threads that answer this exact question, but none of the solutions are working. Here are three threads (some are quite old) that give solutions that I am unable to get working.</p>
  
  <p><a href="https://stackoverflow.com/questions/26697999/gradle-equivalent-to-mavens-copy-dependencies">Gradle equivalent to Maven&#39;s &quot;copy-dependencies&quot;?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/47567864/how-to-copy-dependencies-to-build-directory-in-gradle">How to Copy dependencies to Build directory in Gradle</a></p>
  
  <p><a href="https://discuss.gradle.org/t/how-can-i-gather-all-my-projects-dependencies-into-a-folder/7146" rel="nofollow noreferrer">https://discuss.gradle.org/t/how-can-i-gather-all-my-projects-dependencies-into-a-folder/7146</a></p>
  
  <p>FYI, I've tried, among others:</p>
  
  <pre><code>task copyDependencies(type: Copy) {
     from configurations.compile
     into 'dependencies'
  }
  
  task copyDependencies2(type: Copy) {
      from project.configurations.compile
      into project.buildDir
  }
  
  project.copy {
      from project.configurations.compile
      into project.buildDir
  }
  </code></pre>
  
  <p>If possible, I prefer current recommended best practices methods rather than older deprecated methods. I'm staying on the current Gradle, which is  currently 4.7 as of this writing.</p>