Well Geertjan has an old blog entry how to configure the License Headers in projects, so whenever a new file is being created it shall come with an project appropriate license header.

This page is to document some internal knowledge on how to configure it for different projects without the UI.

Maven Projects

By default when a Maven project license is changed it creates a nb-configuration.xml file with the following property:

nb-configuration.xml
<netbeans.hint.license>license-id</netbeans.hint.license>

This file is put on ignore for version control by default. The setting however can be persisted if this property is specified in the project's pom.xml.

Gradle Projects

Besides of the bug NETBEANS-2288 - Getting issue details... STATUS NetBeans reads the license information from the Gradle project properties. When working with a multi-project Gradle project it is enough to define these properties in the root project.

Any kind of definition is evaluated as a string:

  • The string can match the Short ID or the License URL in the Built-In License Headers
  • The string can be a file path relative to the project dir.
  • The string can be a file path relative to the root project dir. (When this is released: NETBEANS-2756 - Getting issue details... STATUS )
  • The string can be point to an absolute file path.
    (Can be useful as ext.license = file("$rootDir/license.header") in the root build.gradle of a multi-module projects till NETBEANS-2756 in place.)

The properties are evaluated in the following order:

  1. Project's property: netbeans.license
  2. Root project's property: netbeans.license
  3. User's property: netbeans.license
  4. Project's property: license
  5. Root project's property: license
  6. User's property: license


gradle.properties
netbeans.license=apache20

Ant Projects

See the blog entry, however it is the project.license Ant property which is being read and evaluated for the license information.

Built-In License Headers

NameShort IDLicense URL
ASF - Apache License 2.0apache20-asfhttps://opensource.org/licenses/Apache-2.0
Apache License 2.0apache20https://opensource.org/licenses/Apache-2.0
BSD 2 - Clause Licensebsd2https://opensource.org/licenses/BSD-2-Clause
Eclipse Public License 1.0epl10https://opensource.org/licenses/EPL-1.0
General Public License 2.0gpl20https://opensource.org/licenses/GPL-2.0
General Public License 3.0gpl30https://opensource.org/licenses/GPL-3.0
Lesser GPL 2.1lgpl21

https://opensource.org/licenses/LGPL-2.1

MITmithttps://opensource.org/licenses/MIT
NetBeans CDDL/GPLcddl-netbeans-sunN/A
  • No labels