Friday, December 28, 2007

How to set the License for a project in Netbeans 6.0

To set the project license on a per project basis, you need to set a property called project.license to the value of the license you want to use. For example: If I want to use the Apache 2.0 license, I need to set the property to project.license=apache20. This is accomplished by opening the project files and going to the nbproject directory. You will see a file called project.properties, double click on it to edit it.

You then add the line to the of the properties and save. Any java source files created now will contain the Apache 2.0 license.

/*
* Copyright 2007 John Yeary.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing
* permissions and limitations under the License.
* under the License.
*/

3 comments :

immeƫmosol said...

Thanks for sharing this information.
Do you also happen to know where I could change the default contents of the project-properties file?

John Yeary said...

I am not sure I understand which properties you are trying to set. Could you be a little more specific? Most of the projects are controled via the templates.

immeƫmosol said...

I am trying to change the contents of the default project.properties file.
I could then for instance say that by default my new projects have a gpl license by putting something like:
project.license=mygpl
into the default project.properties file.
It currently contains the following when I create a php-project:
include.path=${php.global.include.path}
php.version=PHP_5
source.encoding=UTF-8
src.dir=src
tags.asp=false
tags.short=true
web.root=.

Popular Posts