Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is ${project.licensePath}?

Tags:

java

netbeans

I want to be able to set what license is used in the comment block at the top of a netbeans file. When I look at the template, I see this:

<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">

If this were to actually place a license at the top of my code, I would be delighted. The question is, how do I set ${project.licensePath}, and what should I set it to for, say, the GPL?

like image 337
tbodt Avatar asked Dec 09 '13 01:12

tbodt


1 Answers

Using NetBeans 7.4, go to Template manager

enter image description here

Navigate to "Licenses"

enter image description here

you can add, use, modify, duplicate or delete a license file.

If you want to add a custom license you name it with

"license-blablabla.txt"

(you can save the file whenever you want) and then you can select it from "Add" option.

Then go to your project files and open project.properties

enter image description here

and append a new line

project.license=blablabla

When you create a new class you will see your license file content on the header (blablabla is the suffix of your template filename).

If you want to use an existent template it's so easy, go to Licenses in the Template Manager and select a License, then right click and "properties", you can see the name of the file and then configure your project

enter image description here

enter image description here

and should work

enter image description here

EDIT

I don't know where the default license files are stored (and is not relevant) but if you try to use an incorrect filename you will get

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

EDIT

According to the comments in a netbeans bug 236159 the folder is created in the user's home when you add or modify a template but I can't find it.

like image 63
vzamanillo Avatar answered Sep 28 '22 11:09

vzamanillo