How to use 'resourcelist' in project

When i use groovy and build this, it works fine

def ant = new AntBuilder()
ant.delete(failonerror: false, verbose: true) {
    resourcelist {
        file(file: 'remove.txt')
    }
}

But when i use this code in gradle task this throws exception:

task(temp) << {
    ant.delete(failonerror: false, verbose: true) {
        resourcelist {
            file(file: 'remove.txt')
        }
    }
}

Exception:

Cannot convert the provided notation to a File or URI: {file=remove.txt}.

How can i use ‘resourcelist’ in gradle build script?

I find problem - replace ‘file’ by ‘ant.file’

ant.file(file: 'remove.txt')

How i can get message about don’t existing files in list. Current implementation receives messages about only existing files