IntelliJ does not recognize "/spring.ftl"

My IntelliJ will only recognize "spring.ftl" and not "/spring.ftl" in Freemarker templates using Spring.  The latter is correct where as the former will not work at runtime as the templates I'm working on are not in the root Freemarker directory.  For example:

webApplicationContext.xml

  <bean id="freemarkerConfig" >
    <property name="defaultEncoding" value="UTF-8"/>
    <property name="templateLoaderPaths">
      <array value-type="java.lang.String">
        <value>/WEB-INF/freemarker/</value>
        <value>...other directories...</value>
      </array>
    </property>
  </bean>



/WEB-INF/freemarker/someDirectory/someTemplate.ftl

  <#import "/spring.ftl" as spring>
  ... other freemarker code ...

/WEB-INF/freemarker/someDirectory/someOtherTemplate.ftl

  <#import "spring.ftl" as spring>
  ... other freemarker code ...

The first is correct and will work at runtime, however it is unrecognized in IntelliJ and code completion will not work.  The second is incorrect and will fail at runtime, however IntelliJ does recognize and code completion works.  Do I have IntelliJ misconfigured or is this a bug?  Currently we are stuck using the wrong import to get code completion working and then changing it to the right import before trying to run it.
4 comments
Comment actions Permalink

This is in 10.5 and was also happening in 10.0.3.

0
Comment actions Permalink

I still cannot get this to work.

0
Comment actions Permalink

If it is a bug and not a misconfiguration you could at least use a better workaround of using ../spring.ftl at coding-time and run-time.

0
Comment actions Permalink

"../spring.ftl" does not work either.  

The only thing that does work is "spring.ftl".

0

Please sign in to leave a comment.