Lizenztext und Benutzername | Custom License-text and User-name for NetBeans

Ich habs endlich hinbekommen: jede neue Datei trägt meinen Name als @author und meine eigene Lizenz im Dateikopf.

(For the english version see below)

Eigener Lizenztext

Zuerst müsst ihr den Lizenztext z.B. nach /home/user/quell/license-lgpl.txt kopieren. Der Name dieser Datei ist dabei wichtig.

Als nächstes in der projekt-spezifischen Datei nbproject/project.properties

project.license=lgpl

einfügen. Z.B. innerhalb NetBeans: Einfach euer Projekt in der Dateiansicht ‘File’ öffnen.

Jetzt müssen wir NetBeans noch sagen wo die Datei license-lgpl.txt steckt:

Wähle in Tools->Templates den Knoten ‘Licenses’ aus und

suche mittels ‘Add..’ die vorher kreierte Datei /home/user/quell/license-lgpl.txt.

Diese sollte dann unter Licenses hinzugefügt worden sein.

Nun einfach mittels Rechtsklick auf ein Java Paket ausprobieren:

New->Java Interface auswählen und ‘Constraint’ eingeben.

Veränderter Benutzername

Dies ist ein Trick von Geertjan. Die User.properties öffnen:

in Tools->Templates->User Configuration Properties->User.properties

Dort einfach einfügen

user=Peter Karich, peat_hal ‘at’ users ‘dot’ sourceforge ‘dot’ net

English Translation

I have solved the problem in the latest NetBeans 6.1: every new file has my name as a value for the @author attribute and my own license text as header.

Your own license text

First of all you have to copy your license text e.g. to /home/user/quell/license-lgpl.txt. The name of this file is important.

As a next step go into the project specific file nbproject/project.properties and add

project.license=lgpl

E.g. with the files window within NetBeans.

Now you have to specify that you want to use this file as license text:

Go to Tools->Templates and choose ‘Licenses’ then search via ‘Add..’ the previously created file /home/user/quell/license-lgpl.txt.

To test it right click on a java package and choose:

New->Java Interface auswählen; then type ‘Constraint’ and you should see the license header.

Here is an example of an adapted apache header:

<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}This file is part of the TimeFinder project.
${licensePrefix}Visit http://www.timefinder.de for more information.
${licensePrefix}Copyright ${date?date?string(“yyyy”)} the original author or authors.
${licensePrefix}
${licensePrefix}Licensed under the Apache License, Version 2.0 (the “License”);
${licensePrefix}you may not use this file except in compliance with the License.
${licensePrefix}You may obtain a copy of the License at
${licensePrefix}
${licensePrefix} http://www.apache.org/licenses/LICENSE-2.0
${licensePrefix}
${licensePrefix}Unless required by applicable law or agreed to in writing, software
${licensePrefix}distributed under the License is distributed on an “AS IS” BASIS,
${licensePrefix}WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
${licensePrefix}See the License for the specific language governing permissions and
${licensePrefix}limitations under the License.
<#if licenseLast??>
${licenseLast}
</#if>

Change your user name

This trick is from Geertjan. Open User.properties in Tools->Templates->User Configuration Properties->User.properties

Replace all stuff with

user=Peter Karich, peat_hal ‘at’ users ‘dot’ sourceforge ‘dot’ net

and you are done.

4 thoughts on “Lizenztext und Benutzername | Custom License-text and User-name for NetBeans

  1. Pingback: Why NetBeans? « Java and more …

Comments are closed.