How to use File tree in CustomTask


(Dheeraj M) #1

Hi, I have a custom task in Gradle. I would like to use file tree inside it.
I am trying somethig like below. But I am getting error while running the task.
Please let me know where am I going wrong.

task myTask(type: MyTask){
}

class MyTask extends DefaultTask{
@TaskAction
void parse() {
FileTree tree = Project.fileTree(dir: ‘D:/Gradle_project’,includes: [".txt","//.txt"], excludes: ["/dheeraj/"])
tree.visit{
file->
def currentjws=file.relativePath
}
}
}