How can I gather all my project's dependencies into a folder?

Think this would work:

task copyRuntimeLibs(type: Copy) {
    into "lib"
    from configurations.testRuntime - configurations.runtime
  }