Gradle fileTree exclude all except certain directories
问题 I am using the fileTree utility to get a list of files but need to exclude all directories except a select few from the list. My directory structure: node_modules/ react-native/ react/ third-party-package/ another-package/ I need to exclude all directories except the ones named react-native and react. Currently I am excluding all node_modules, but this is not what I want... fileTree(dir: '.', excludes: [ 'node_modules/**'] ) How would I do this with the fileTree? 回答1: You can use a closure