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.
Product Version = NetBeans IDE 7.1 RC2 (Build 201111302200) Operating System = Windows XP version 5.1 running on x86 Java; VM; Vendor = 1.6.0_29 Runtime = Java HotSpot(TM) Client VM 20.4-b02
Example: pom.xml <properties> <copyrightyear>2011</copyrightyear> </properties> Template Class.java <#assign licenseFirst = "/*"> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "../Licenses/license-${project.license}.txt"> // ${copyrightyear} <#if package?? && package != ""> package ${package}; ...
Result: // Expression copyrightyear is undefined on line 6, column 6 in Templates/Classes/Class.java.
Might be useful. Never heard of anyone trying this before. http://wiki.netbeans.org/NetFIX candidate I think.
Created attachment 114107 [details] Generic license header A example for the intended use of custom properties in FreeMarker templates is illustrated in the attached license template file. By using this scheme you dont need a separate license file anymore for each and every project. A single file per license type together with an appropriate set of properties in the pom (or nbproject/project.properties) is then sufficient.
my personal preference would be to have all such properties prefixed with "netbeans.template" or similar to avoid unintended replacements and to have optionally a way to create a UI in netbeans for these props.
project.property prefix is used for properties coming from MavenProject.getProperties() please note that properties containing a dot cannot be nested. eg. you cannot have both maven.test and maven.test.skip property. even if just one of them is used in the template, during preparing of the data, the created freemarker object tree will only contain one of the and give error for the second one when used (most likely randomly.
Integrated into 'main-golden', will be available in build *201207260002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/5b5d997d1607 User: Milos Kleint <mkleint@netbeans.org> Log: #206321 maven project's properties are available in new file templates via project.property.<name> expressions.