English 中文(简体)
one template to several output files with fmpp
原标题:

I want to set up an maven plugin that will take a few freemarker templates, and expand each one several times, each time with a different set of input values. Is there any better way to do this with fmpp that brute force processing them over and over?

最佳回答

When you say set up a maven plugin, do you mean write your own?

If you want to just use fmpp with Maven and avoid writing a plugin you could do this:

Use the maven-antrun-plugin and process your files with a small snippet of Ant script using the fmpp Ant task (fmpp.sourceforge.net/ant.html). Combined with the ant-contrib task (ant-contrib.sourceforge.net/tasks/tasks/index.html) you should be able to loop quite easily over a set of files.

问题回答

Whether you use FMPP from a Maven plugin or not, the pp hash provides exactly what you need. Have a look at http://fmpp.sourceforge.net/pphash.html#key_changeOutputFile. You can call that function in a loop, producing a different output file for each iteration.





相关问题
Can a freemarker viewpage be user editable and secured?

If I let anyone modify a freemarker viewpage, can I somehow make it hack free? I know I read somewhere that I can make disable scriplets, but that was for .jsp pages so not sure if it will work with ...

can freemarker be used to output custom collections?

Can freemarker be used to loop through collections and output the properties of each item in the collection? This collections properties will be dynamic i.e. can t be hard coded, will be generated ...

one template to several output files with fmpp

I want to set up an maven plugin that will take a few freemarker templates, and expand each one several times, each time with a different set of input values. Is there any better way to do this with ...

Nullable date in Freemarker

This is a piece of my freemarker template: ${order.needByDate?if_exists?date} I want it to work as following: if needByDate is null, then write nothing if it is not null, then write the date part ...

Freemarker template not found

I m currently trying to get Freemarker to work with my application using Spring. No matter what I try I keep getting template not found. I am not sure if I have the configuration set up properly, ...

Spring Security Custom freemarker form

I m currently working on a project were we use freemarker as a template language. Instead of using the defualt login form I have created a custom controller and a custom freemarker view which goes ...

热门标签