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 210265 - Custom License file is not adding in new Java class of eclipse project (tools -> Templates -> licenses)
Summary: Custom License file is not adding in new Java class of eclipse project (tool...
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 7.2
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-28 12:10 UTC by vidhyadharantechdays
Modified: 2012-04-02 14:51 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vidhyadharantechdays 2012-03-28 12:10:42 UTC
I have created a project from Eclipse workspace. via File - > import eclipse project.

And i have added a new custom license via Tools -> Templates -> Licenses

1. Then i added the following property in to nbproject/project.properties file 
         project.license=custom
2. Then i created a new java class, Right click the project  New -> New class

   Unfortunately the created new class have only default license file , instead of my custom license .

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

But this is taking effect for Netbeans projects but not for Imported Eclipse project.

To Reproduce this issue , create a new project in eclipse and do the above steps.
Comment 1 Jesse Glick 2012-03-30 14:28:19 UTC
So I created a text file

---%<--- /tmp/license-liberal.txt
<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}Do what thou wilt shall be the whole of the Law.
<#if licenseLast??>
${licenseLast}
</#if>
---%<---

then Tools > Templates > Licenses > Add... and selected it. Now File > New Project... > Java > Java Class Library, etc., open nbproject/project.properties from Files, add

project.license=liberal

and save, then File > New File... > Java > Java Class, etc., and has

/*
 * Do what thou wilt shall be the whole of the Law.
 */

as expected - fine so far.

Now, started Eclipse (Indigo), File > Switch Workspace > /tmp/testws, File > New > Java Project, "p", Finish; File > New > Class, etc.; close Eclipse. Back in NB, File > Import Project > Eclipse Project, Import Projects from Workspace, /tmp/testws, Next, select p, Create imported NetBeans projects in a separate location, /tmp/imported, Finish. Added same line to project.properties, saved. Now made a new Java Class as before, and as expected saw the desired license header.
Comment 2 vidhyadharantechdays 2012-04-02 09:41:09 UTC
Yes its work for me as well.

My mistake is that i didn't created the license file in the NB format .

I just created , like this

/*
 *  Copyright 2009-2012 by vidhyadharan
 */

instead of

<#if licenseFirst??>
${licenseFirst}
</#if>
 ${licensePrefix}Copyright 2009-2012 by vidhyadharan
 ${licensePrefix}
 <#if licenseLast??>
 ${licenseLast}
</#if>
Comment 3 Jesse Glick 2012-04-02 14:51:01 UTC
OK. By the way it is possible to substitute the current year (${date?date?string("yyyy")}) and I think also username (somehow).