8

Can anybody reproduce the following?

In my NetBeans 7.2 project I've set the "project.license" property (in project.properties) to "apache20" so that NetBeans generates the appropriate license text in every new .java file. The license text (which is located in "license-apache20.txt") contains the following FreeMarker reference:

${project.organization!user}

When "project.organization" is not set it displays my user name as expected. Also, when I set a custom user name in the User.properties file it displays this user name instead. So far so good.

However, I want to set the "project.organization" property. But when I do this in the project.properties file NetBeans simply doesn't recognize it, displaying my user name instead.

When I remove "!user" from the FreeMarker reference it generates the text "Expression project.organization is undefined on line 4, column 59 in Templates/Licenses/license-apache20.txt." When I set the property in User.properties instead (silly place, but I did it for sake of analysis) I get the same behavior. Does anyone know what might be wrong or how to get NetBeans to find the "project.organization" property? Does anyone have the same behavior on his or her NetBeans?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Rinke
  • 6,095
  • 4
  • 38
  • 55

1 Answers1

6

In license-apache20.txt (or any other license template), change ${project.organization!user} to ${organization!user}

In NetBean menu, ToolsTemplate, when you click the Setting button, a User.properties file is opened. Add organization=FooBar Inc there.

(This is not very ideal, but at least it allows to customize the organization.)

Ky -
  • 30,724
  • 51
  • 192
  • 308
Tan Hui Onn
  • 424
  • 4
  • 8
  • 1
    Yes, I did and I get the same behavior. (I mentioned this in my question.) Thanks for your answer. – Rinke Mar 14 '13 at 09:42
  • I have tried it. It is as you said. But it will work if you change project.organization to organization. I think '.' is causing the problem. – Tan Hui Onn Mar 15 '13 at 08:09
  • That's very interesting. I tried what you suggested, but I can't get it to work. Could you be a little more specific which texts (and in which files!) you change to get it to work? Maybe you could edit your answer. If it works you'll have my eternal gratitude + upvote + accepted answer. – Rinke Mar 15 '13 at 11:05
  • In order not to pollute the global properties, I installed Template Settings4p. I set organization via a project's properties there. Works too. – Tobias Jul 10 '18 at 03:33