I’ve been using FreeMarker for a little while now, but there’s one glaring piece of functionality that is either missing or I just can’t figure out (I hope the latter!). If you pass cfg.getTemplate() an absolute path, it just doesn’t work. I know you can specify a template directory, but I can’t afford to do that, my use case could deal with files in any directory. Is there any way to set FreeMarker to render absolute paths the way any user would expect?
Share
I had to use the absolute path because the templating is happening in an Ant script and the templates are on the file system and discovered with an Ant fileset. I guess these are quite some unique requirements…
Anyway,for the posterity (as long as SO is up), here’s a solution that works:
and the initialization is: