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?
Using NetBeans 7.4, go to Template manager
Navigate to "Licenses"
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
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
and should work
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With