Seapegasus Blog

All | Hacks | Java Mobility | Mac | Misc | NetBeans | NetBeans_de
« Attack of the Killer... | Main | Happy Viking! »
20080609 Monday June 09, 2008

Tip: Create Your Own Project Template

If you work on a series of projects that all share a common set-up (properties, build-script, base classes, resources, etc) you will probably do a lot of copying and pasting and refactoring to clone the base project. Did you know you can create your own custom project template for that purpose? I just found that out recently (from the help menu).

Basically you point the IDE to an existing NetBeans project and tell it to use that as a template. You use a module project as a wrapper: This will allow you to turn the template project into an NBM file ("NetBeans Module") that can be installed into the IDE like a plugin. After installing the custom plugin, the template project will appear in the "New Project" wizard. This is how you do it:

  1. Take a NetBeans project that you want to be the template project, and open it in the IDE. Let's call it FooApp.
  2. Create an empty NetBeans Module project. Name it something recognizable (such as FooAppTemplate or whatever).
  3. In the Projects window, right-click the empty module project. Create a new file by choosing New > Other > Module Development > Project Template from the context menu.
  4. Use the Template Wizard to configure the template. Point it to the template project FooApp and choose a category (Java SE, Java EE, Java ME, Ruby, etc).
  5. Here comes the important part - you save the template as an NBM file. Right-click the module project in the Projects window, and select Create NBM. Look into the Output window to see where the file was saved (for instance FooAppTemplate/build/myorg-fooapptemplate.nbm).
  6. To install the template into the IDE, go to Tools > Plugins > Downloaded. Click Add Plugin, browse to your NBM file and install it. If you give the NBM file to other developers, that's how they install the template.
  7. (Alternatively, right-click the module project in the Project window and select "Install in Development IDE". This is another way to install it for somebody who has the module project still open.)

Go to File > New Project and open the category you picked before, and ta-daa, there is your custom project template. :)

Posted by seapegasus ( Jun 09 2008, 04:53:47 PM CEST ) Permalink Comments [2]


Comments:

Information through "VENU"

Posted by venugopal on June 09, 2008 at 07:33 PM CEST #

Hi Ruth,

Is there any way to create a new kind of project template, neither Java, NetBeans Modules nor C/C++, etc...?

Like someone is adding support for Scala, he would prefer to have his language specific Project Template, rather than make use of any existing template.

Any suggestions?

Thanks,
Varun

Posted by Varun on June 10, 2008 at 06:50 AM CEST #

Post a Comment:

Comments are closed for this entry.

Calendar

Content

Search

Links

RSS Feeds

Recent...