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:
<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-2288Getting 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-2756Getting issue details... STATUS )
- The string can be point to an absolute file path.
(Can be useful asext.license = file("$rootDir/license.header")
in the rootbuild.gradle
of a multi-module projects till NETBEANS-2756 in place.)
The properties are evaluated in the following order:
- Project's property:
netbeans.license
- Root project's property:
netbeans.license
- User's property:
netbeans.license
- Project's property:
license
- Root project's property:
license
- User's property:
license
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
Name | Short ID | License URL |
---|---|---|
ASF - Apache License 2.0 | apache20-asf | https://opensource.org/licenses/Apache-2.0 |
Apache License 2.0 | apache20 | https://opensource.org/licenses/Apache-2.0 |
BSD 2 - Clause License | bsd2 | https://opensource.org/licenses/BSD-2-Clause |
Eclipse Public License 1.0 | epl10 | https://opensource.org/licenses/EPL-1.0 |
General Public License 2.0 | gpl20 | https://opensource.org/licenses/GPL-2.0 |
General Public License 3.0 | gpl30 | https://opensource.org/licenses/GPL-3.0 |
Lesser GPL 2.1 | lgpl21 | |
MIT | mit | https://opensource.org/licenses/MIT |
NetBeans CDDL/GPL | cddl-netbeans-sun | N/A |