Skip to content

Instantly share code, notes, and snippets.

@qrtt1
Created May 23, 2016 04:27
Show Gist options
  • Save qrtt1/175dd69b1db17cc97b2cfbf797b6b1b3 to your computer and use it in GitHub Desktop.
Save qrtt1/175dd69b1db17cc97b2cfbf797b6b1b3 to your computer and use it in GitHub Desktop.
Gradle files(), fileTree()
//
// Demo Structure
//
// qty:lab qrtt1$ tree
// .
// ├── build.gradle
// └── libs
// ├── a.jar
// └── vendorA
// └── b.jar
//
// 2 directories, 3 files
apply plugin: 'java'
println "\n\nfiles"
println files("libs/a.jar").collect()
println "\n\nfileTree"
println fileTree(include:['*.jar'], dir:"libs").collect()
println "\n\nfileTree with nested dirs"
println fileTree(include:['**/*.jar'], dir:"libs").collect()
//
// qty:lab qrtt1$ gradle
//
//
// files
// [/Users/qrtt1/Downloads/lab/libs/a.jar]
//
//
// fileTree
// [/Users/qrtt1/Downloads/lab/libs/a.jar]
//
//
// fileTree with nested dirs
// [/Users/qrtt1/Downloads/lab/libs/a.jar, /Users/qrtt1/Downloads/lab/libs/vendorA/b.jar]
// :help
//
// Welcome to Gradle 2.12.
//
// To run a build, run gradle <task> ...
//
// To see a list of available tasks, run gradle tasks
//
// To see a list of command-line options, run gradle --help
//
// To see more detail about a task, run gradle help --task <task>
//
// BUILD SUCCESSFUL
//
// Total time: 5.216 secs
//
// This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.12/userguide/gradle_daemon.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment