Icon

Software Engineering, Architecture, Web Development and beyond…

Netbeans: Adding a project license to your project

I see lots of questions in Netbeans forums about Templates and project license and developers has problems with configuring it. If you want to add a project license and associate it with your project, you need to add a license property in your project configuration file. The property file “nb-configuration.xml” lies in your project folder, in my case:

Erhan-Bagdemirs-MacBook-Pro:NetBeansProjects merodach$ pwd
HOME/NetBeansProjects

You have to add just”” in your properties:

<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
     ...
    <netbeans.hint.license>mylicense</netbeans.hint.license>
     ...
</properties>

and create a new licence file under:
HOME/.netbeans/6.9/config/Templates/Licenses

after a new installation of Netbeans (i have the version 6.9.1), there was no License folder. If you can’t see this folder, just create it and create a license file accordingly:
HOME/.netbeans/6.9/config/Templates/Licenses/license-mylicense.txt

The name of the license file is important and must follow this naming template:
license-${project.license}.txt

${project.license} is the property which you added with ““.

Open “Template Manager” on your IDE, following the menu path “Tools > Templates”. For Java classes the template seems like this if you open template in your editor:
null
and you can see the path to your license and how it is associated with your project. We make no changes in the template and just create now a new java class to test our license (in my case, apache’s open source license):

null

erhan

Author


Hello, I'm Erhan Bagdemir and this is my blog. I talk about Java, J2EE, Frameworks, web application development, OOAD and various other topics often related to programming.

Erhan Bagdemir  Profil von Erhan Bagdemir auf LinkedIn anzeigen

ebagdemir on Stackoverflow

ebagdemir on Twitter

    Hamburg

    Slideshow