This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
It looks like it is not possible to reference files using relative or absolute path in <#include filename>. The <#include> works just in case the referenced file is in the same folder as the template. See attached test SCFTHandlerTest.testCreateFromTemplateUsingFreemarkerAndInclude. Neither <#include "../includes/include.txt"> nor <#include "/includes/include.txt"> works.
Created attachment 39547 [details] SCFTHandlerTest.testCreateFromTemplateUsingFreemarkerAndInclude
I see. I'll try to see freemarker docs of what needs to be done.
Freemarker seems to support something called "acquisition" include, see: http://freemarker.sourceforge.net/docs/ref_directive_include.html I'll (next week) or you can (today) modify the test to use <#include "*/includes/include.txt"> and see if that will work. Imho, it should. If not (possibly there can be problem with root of templates), I'll investigate and fix next week.
<#include "*/includes/include.txt"> does not help. It is for cases you would place the file to some parent folder. You will have to configure the freemarker. See http://freemarker.sourceforge.net/docs/pgui_quickstart_createconfiguration.html
Try it now. Imho both */path as well as ../path will work now. See the changes in the test for example: Checking in test/unit/src/org/netbeans/api/templates/ProcessorTest.java; /shared/data/ccvs/repository/libs/freemarker/test/unit/src/org/netbeans/api/templates/ProcessorTest.java,v <-- ProcessorTest.java new revision: 1.3; previous revision: 1.2 done Checking in src/org/netbeans/libs/freemarker/FreemarkerEngine.java; /shared/data/ccvs/repository/libs/freemarker/src/org/netbeans/libs/freemarker/FreemarkerEngine.java,v <-- FreemarkerEngine.java new revision: 1.3; previous revision: 1.2 done Checking in src/org/netbeans/libs/freemarker/RsrcLoader.java; /shared/data/ccvs/repository/libs/freemarker/src/org/netbeans/libs/freemarker/RsrcLoader.java,v <-- RsrcLoader.java new revision: 1.3; previous revision: 1.2 done Checking in nbproject/project.properties; /shared/data/ccvs/repository/libs/freemarker/nbproject/project.properties,v <-- project.properties new revision: 1.3; previous revision: 1.2 done Checking in manifest.mf; /shared/data/ccvs/repository/libs/freemarker/manifest.mf,v <-- manifest.mf new revision: 1.3; previous revision: 1.2
In order to make this working even in IDE I changed order of attribute evaluation. FREEMARKER_TEMPLATE is preferred to ScriptEngine.FILENAME now. Unfortunately javadoc of ScriptEngine.FILENAME is a bit loosely defined so it is unclear if it should contain also the path. More appropriate attribute for the executed resource would be ScriptEngine.URL IMO but it is another story. /cvs/libs/freemarker/src/org/netbeans/libs/freemarker/FreemarkerEngine.java,v <-- FreemarkerEngine.java new revision: 1.4; previous revision: 1.3