Using ant fmpp freemarker tasks


(shabe razvi) #1

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()
            </data>
</fmpp>

I’ve declared a new task in gradle -

ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask') {
   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?
            }
    }

(Peter Niederwieser) #2

Have you tried this?

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

(shabe razvi) #3

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

Cheers