Skip to content

Instantly share code, notes, and snippets.

@dogukancagatay
Last active July 18, 2018 06:43
Show Gist options
  • Save dogukancagatay/0dfcb4ccacdd702df4d0304e33f0a26e to your computer and use it in GitHub Desktop.
Save dogukancagatay/0dfcb4ccacdd702df4d0304e33f0a26e to your computer and use it in GitHub Desktop.
Downloads JAR dependencies with Gradle and saves them on `lib` path.
apply plugin: 'groovy'
repositories {
jcenter()
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
compile 'org.apache.commons:commons-io:1.3.2'
}
task downloadDeps() {
project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.each { config ->
println "Processing ${config.getModuleName()} (${config.module})"
def moduleFile = project.configurations.compile.find { it.name.startsWith(config.getModuleName()) }
def libDir = new java.io.File("lib")
libDir.mkdir()
moduleFile.renameTo(new java.io.File(libDir, moduleFile.getName()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment