2009-08-11

Using license with NetBeans project



When you're using GPL or LGPL with your project - you should add license statement to every source file of your project. Using NetBeans it's not that simple - you have to use PROJECT/nbproject/project.properties file to add project.license=default_2 for example, using file name of your license template (but not template name itself). To make your life even harder - GPL and LGPL statements are using name of your project three times. Because of this I created separate templates for each of my (L)GPL projects to include project name. Because of this is took a time to set a complete new project. Now I found solution how to make NetBeans use single GPL template for all projects:

1. use ${project.name} for name of your project. For example: "This file is part of ${project.name}.".
2. in file PROJECT/nbproject/project.properties add project.license=default_1 (or any other file name for your license).
3. in same file (PROJECT/nbproject/project.properties) add project.name=MyNewProject

Now create new Class file and check license header of your file. Hope you'll enjoy!

1 comment:

Unknown said...

That is a good start. Check out this tutorial on project level licenses in NetBeans IDE , it describes the process a little better.