Hack Your Own Custom NetBeans Project Templates
Join the DZone community and get the full member experience.
Join For FreeSomebody 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:
- 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.
- 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".
- 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!
Opinions expressed by DZone contributors are their own.
Comments