An alternative solution to the native NetBeans license header management (see my previous post) is the “License Changer” plugin by nhoffmann available on NetBeans plugin portal (http://plugins.netbeans.org/plugin/17960/license-changer).
The plugin is based on license template concept. NetBeans installation includes several license templates (Tools → Templates) for the most popular Open Source licenses: The plugin uses one of the available templates. If you have your own license file, you have to include it in the template list (but the plugin help on this).
NOTE: all custom license files will be saved in the NetBeans User Directory. You can have a look at the beginning of View → IDE Log for your real path.
With the plugin we can do more that native NetBeans solution except for one use-case: when you have a proprietary and project specific license. In this case NetBeans let us save the license file within the project (so all team members can use it) while, with the plugin, all licenses are stored in the user NetBeans installation (which is not shared across the team).
Let’s describe now the plugin.
After plugin installation, you can select a file or a package and apply “Change License Header” (see picture below).
Second page of the wizard is the following:
We can select the license from the template list (see 1) or browse the disk for a custom license file (see 2) which will be included in the template list by the plugin.
IMPORTANT: The checkbox “Set as default project license” (see 3) is very important. If checked, the plugin will save the selected license in the project configuration (the same used by native NetBeans solution). All new created files (including file types not supported by the plugin) will inherit the setting and they will have the correct license header.
After license selection:
NOTE: One little annoying problem with the plugin is that the selected license is not kept for the following plugin invocations.
Typical procedure :
- install the plugin
- run the plugin on a project file or package or folder,in order to include all existing project files
- use standard NetBeans File → New File procedure to create new project files