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.

Bug 92490 - Support for project specific templates (primarily license ones)
Summary: Support for project specific templates (primarily license ones)
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Templates (show other bugs)
Version: 5.x
Hardware: Other Windows XP
: P3 blocker with 2 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 122916 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-13 14:42 UTC by tkellerer
Modified: 2013-09-02 12:39 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tkellerer 2007-01-13 14:42:37 UTC
The templates are a fine thing, but usually each project I work on uses a
different header for the source files, so basically when working on several
projects at the same time (e.g. different customers) I always have to modify the
generated header after creating a new file..

It should be possible to create project specific templates, so that the header
for e.g. "Java class" looks different in Project1 compared to Project2
Comment 1 Milos Kleint 2007-08-27 18:38:38 UTC
AFAIK this is already possible in 6.0..
Comment 2 tkellerer 2007-08-27 19:24:06 UTC
So, how does it work then? 
There is nothing mentioned in the online help
Comment 3 Milos Kleint 2007-08-28 07:24:45 UTC
there's no UI for it now.

you open the nbproject/project.properties file and add the "project.license" property.
eg.
project.license=cddl-netbeans-sun


the value is the file name (the display name can differ for some predefined templates)of the license template in
Tools/templates dialog, category Licenses..

for maven based projects, you add netbeans.hint.license property to the pom.xml. Some (currently apache 2.0 only) get
recognized by the <licenses> element in POM, if present.
Comment 4 tkellerer 2007-09-01 23:11:16 UTC
Thanks for the description. Although this seems to cover only the license (starting comment) part, it seems it could be
taken further using the #include directive. 
Comment 5 tkellerer 2007-09-01 23:16:15 UTC
Another thing: I think it would make a lot more sense if the license file was searched in the project's (source)
directory not in NB's userdir. The file belongs to the project, not to the NB "installation".
Comment 6 elberry 2007-09-04 22:50:57 UTC
I agree, wouldn't this be a bit more intuitive if the project.license property was something like
project.license.file=[some file relative to the project's root]?

::shrugs:: Just my 2 cents.
Comment 7 Petr Dvorak 2008-04-22 16:50:31 UTC
*** Issue 121608 has been marked as a duplicate of this issue. ***
Comment 8 Petr Dvorak 2008-04-22 16:54:44 UTC
*** Issue 122916 has been marked as a duplicate of this issue. ***
Comment 9 Peter Pis 2008-08-18 08:51:07 UTC
IMHO, this issue should be tracked in "projects" component.
Comment 10 rost 2008-09-18 14:16:35 UTC
I just stumbled over the same problem:
I have a NetBeans project in a subversion repository. Whenever a developer checks out the project and tries to add a new
file the following error message appeares at the top of the new file:

-------------
Error reading included file Templates/Classes/../Licenses/license-lgpl.txt
-------------

This is because the templates (in my case our license template) is not part of the project but must be distributed by
other means. This is really standing in our way now...
Comment 11 Antonin Nebuzelsky 2010-03-29 14:10:13 UTC
Change of default owner.
Comment 12 Milos Kleint 2012-08-31 16:10:26 UTC
It's not even currently possible to #include a file with absolute path (eg. to the project directory)

http://freemarker.org/docs/app_faq.html#faq_template_uploading_security
seems to suggest that it's intentionally so. Reassigning to platform templates to change freemarker configuration to allow certain includes (by url, absolute path, whatever)
Comment 13 Martin Entlicher 2013-09-02 12:39:12 UTC
Templates management was reworked and now it's possible to manage licenses in Templates and associate them with projects.