How to configure the freemarker template path or what's the default path?
Answered
The freemarker syntax highlight is very good feature.
But for "
<#include "abc/abc.ftl" />
The Intellij Idea can't tell where to find the file, it will warning "cannot resolve directory"
so, please tell where it will find the file? or how to configure the path?
thanks
Please sign in to leave a comment.
Use @ftlroot, see https://intellij-support.jetbrains.com/hc/en-us/community/posts/206196939-Getting-Intellij-to-pick-up-Freemarker-macros for more details.
Thanks, after some research, I find an official solution with Intellij Idea 2017.2 Ultimate version.
1. find a red warning , for example ,
use " OPTION + Enter (Mac OSX)" , will popup a windows, just following the step:
2. choose "Define template root in comment (global)
it will create a new file, under "/src/main/resources" , filename is freemarker_implicit.ftl , update the path by your setting
[#ftl][#-- @implicitly included --][#-- @ftlroot "../webapp/WEB-INF/pages" --]3. if need, use File -> Invalidate Caches/Restart
4. use it . just like
thanks for the following pages:
https://blog.jetbrains.com/idea/2009/08/enabling-implicit-context-variables-resolution-in-template-files/
https://github.com/andonescu/springmvc-freemarker/blob/master/src/main/webapp/WEB-INF/freemarker/lib/implicit.ftl