R. has posted 11 posts at DZone. View Full User Profile

Hack Your Own Custom NetBeans Project Templates

06.11.2008
| 19011 views |
  • submit to reddit

Somebody recently asked in a forum how he could turn NetBeans projects into project templates. Say, you want to start a series of projects with the same properties and classes, or maybe you want to pass on a well-working custom setup to colleagues.

There must be a more elegant way than copying a project directory and then refactoring it? Turns out there is: The Help menu quickly informs me to use the Project Template wizard. (Mental note to self: Look into Help menu more often.) Not only can you create custom project templates, you can even distribute and install them as easy as plugins! :D This is how:

  1. Create the project that you want to be the template, and open it in NetBeans. The template project can include properties, classes, resources, an Ant script... — whatever you need.
  2. Here's the thing: Create a new empty NetBeans Module project. Right-click the module project and create a Project Template file (New > Other > Module Development > Project Template):

    Click Next and point the Project Template wizard to the template project and assign a category, like "Java EE" or "Samples".

  3. Right-click the module project and select "Install in Development IDE". Your project template is added to the New Project dialog, in the category you assigned earlier.

Tip: Right-click the module project and select Create NBM. The template is saved as an NBM file to the module project's build directory. This way you can distribute and install your custom template like a plugin, using the Plugins Manager.

You can find a more detailed version of how to create your own project templates in my blog. Geertjan goes into even more detail in his related article about how to add Custom Project Samples. He shows you how to add a custom icon and a description, and even how to hack the New Project wizard and add new panels to it — check it out!

AttachmentSize
new-proj-template.png97.12 KB
0
Your rating: None
Published at DZone with permission of its author, R. Kusterer.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Luan O'carroll replied on Thu, 2008/06/12 - 11:22am

Nice tip, but the link to your blog points to a preview version and isn't accessible :-(

R. Kusterer replied on Thu, 2008/06/12 - 11:49am in response to: Luan O'carroll


Oops, thanks, I updated it to a real permalink!

Matt Coleman replied on Fri, 2013/01/18 - 1:42am

LOL...you can do this...soooo coool!

buffalo freelance website designer 

Ron Abner replied on Thu, 2013/03/28 - 7:10am

Oh, thank you for this post. I was curious how to use this technology. I still have some doubts, but I will figure out how to do this, sooner or later.

Ricky Smith replied on Wed, 2013/04/17 - 4:24am

 Thanks for writing this. I really feel as though I know so much more about this than I did before. Your blog really brought some things to light that I never would have thought about before.


social media campaigns

Sonia Newton replied on Wed, 2013/05/01 - 11:04pm

Can i hack Grand Fantasia Hack  with c++ ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.