Using ant fmpp freemarker tasks

How can I call the ant freemarker fmpp task from within my build.gradle? Has anyone tried this? In a build.xml you would do -

<fmpp sourceFile="templates/blah.ftl" outputFile="output/blah.xml">
            <data expandProperties="yes">
                 ant: antProperties()

I’ve declared a new task in gradle -

ant.taskdef(name: 'fmpp', classname:'') {
   classpath {
        fileset(dir: 'libs', includes: '*.jar')

so can use it via ant.fmpp() - however I can’t get it to recognise the dataloader for expanding ant properties using antProperties().

I need to get it working as follows -

ant.fmpp(sourceFile:"templates/blah.ftl", outputFile:"output/blah.xml") {
            data(expandProperties:'yes') {
                // how to get antProperties() working here?

Have you tried this?

data(expandProperties: 'yes', 'ant: antProperties()')

Thanks that worked. Funny, I thought that I had tried that already and got “antProperies nested element is not supported…”