task doSomething (type: ProduceFilesTaskType) {
outDir = file("$projectDir/some/files")
}
task mytask (type: ConsumerFilesTaskType) {
fileList = file("$doSomething.outDir/somefolders/").listFiles().toList() // null pointer exception
}
The ConsumeFilesTaskType
in above example takes in a List<File> fileList
which I am producing with first task. Now because these files don’t exist yet, gradle fails at configuration stage with error Cannot invoke method toList() on null object
What should I do?