Wednesday, July 24, 2013

NetBeans 7.4 Tip of the Day: Adding A Custom License to NetBeans

I am really enjoying the new NetBeans 7.4 Beta. It features a new mechanism to add license headers to your project. It also allows you to switch the license easily in your project as well. In this example I will add a new BSD 3-Clause License "New BSD" to the Template Manager. This makes it easier to create a project using any variety of license that is required.

We will be adding the following file license-bsd_3.txt.

Note: The license file must start with the prefix license- and end with .txt.

  1. Download license-bsd_3.txt, or create your own.
  2. Open Tools → Templates → Licenses
  3. Click Add and add the license file. It will be installed as license-bsd_3.txt
  4. Click Rename and rename the file to BSD 3-Clause License.
  5. Create a new Maven project. Open the properties for the project and go to License Headers. Select use global license and select our new license.
  6. Create a Java class and the license should contain our new license.

UPDATE: I was asked via twitter about the organization property. This is set from Tools → Templates → Settings. Add a property called organization.


Popular Posts