This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Should be able to make templates for various project types without writing a module: create proj dir, initial metadata files, maybe initial sources. Maybe permit macro substitutions or something. Later could add a GUI to manage them, but initially just something a power user could do after reading a how-to.
Yes, please do so! Here's my use-case: Our coding style requires that the Java source directory is called 'java' and not 'src'. This small glitch prevents me from creating new projects with NetBeans. If I had a wish for free - our build.xml is located in a separate directory 'etc', with ${basedir}==.. etc -- build.xml java -- foo.bar.... test -- test.foo.bar... Could also solve issues like http://www.netbeans.org/issues/show_bug.cgi?id=49780
Of course you *can* create projects with sources in java/ using NB, but you would need to manually clean up the layout (and project.properties) on disk. Currently we do not support placing build.xml in a subdirectory for j2seproject's. I don't think we ever will. You can however do so for freeform projects. As a rule, j2seproject's (or other fixed-form project types) make some simplifying assumptions about the user's project structure that allow the IDE to do more of the work setting things up, while freeform projects permit a much broader set of project layouts for those users who have a predefined project style they want to adhere to. BTW Joerg: when adding comments to an issue, generally you want to add yourself to the CC list, or you will never see any responses.
I did something like this for sample projects distributed with vbuilder. Each sample comes as a module with a layer entry: <folder name="Templates"> <folder name="Project"> <folder name="Samples"> <folder name="Speech"> <file name="banking.zip" url="banking.zip"> <attr name="template" boolvalue="true"/> <attr name="instantiatingWizardURL" urlvalue="nbresloc:/com/nuance/tools/samples/banking/resources/templateDoc.html"/> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.nuance.tools.samples.banking.resources.Bundle"/> <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/com/nuance/tools/samples/resources/projectTreeIcon.gif"/> <attr name="instantiatingIterator" newvalue="com.nuance.tools.samples.SampleProjectIterator"/> </file> </folder> </folder> </folder> </folder> and the implementation of SampleProjectIterator is just a single panel for selecting the directory to unzip banking.zip into. The unzipping is done in instantiate() (after checking to make sure there isn't already a project there by that name). My implementation is too specific to my project type, but you get the idea...
*** Issue 59515 has been marked as a duplicate of this issue. ***
See issue 59515 for more extensive comments, but to be brief: * NetBeans project configuration is very flexible but can have literally unbounded complexity. * Very few individuals within an organization will attain the skill to produce and maintain such projects. * These individuals need a way to package such project as templates for easy "end-user" use by everyone else in a development organization. Things I believe should be included are: * Ability to declare custom project parameters/properties in the template that will be presented/queried by the project creation wizard when one creates a project from the given template. * Ability to script (as part of the project template) creation of project artifacts based on normal and custom project parameters/properties (and possibly recreation/update on redefinition of project parameters via GUI). * Artifacts include build.xml, project.xml (e.g. to automate classpaths in free-form projects), etc... * I have used Ant scripts from the command line for this purpose and it has worked quite well for me.
In NB 4.2 you will be able to use a wizard from the module development support to create a module that supplies a project template (of whatever type) as a subwizard in New Project. You don't have to write any code - a Java class for the wizard is created for you which can be edited but need not be - but you do have to make a module project and create an NBM from it etc., which may well be too intimidating for most IDE users. On the other hand, the NBM thus created should be easily portable to anyone else's IDE installation and can be managed using the Module Manager and/or Update Center. I would not want to provide anything too complex in the intermediate space (i.e. stopping short of creating a module) because for "interesting" configuration you are likely to want a GUI wizard anyway, and this really needs to use the IDE's APIs for displaying wizard panels etc. But something reasonably simple and easy to learn with some scriptability would be nice. Jess Holle's idea for binding a template to an Ant target which would create the project metadata files is intriguing. However it would not on its own deal with parametrization of the template, except insofar as you can use <input> from the target to ask the user some questions.
well, I guess our time is better spent elsewhere. -> wontfix. Please note that some project management systems like maven provide ways to generate projects from templates (called archetypes). I suppose people wanting to have netbeans ant project templates could reuse that. http://maven.apache.org/plugins/maven-archetype-plugin/
IIRC Geertjan also had some blog posts about using Groovy to generate projects from template.
Yes, Groovy is perfect for this purpose. See this screencast for details: http://netbeans.tv/screencasts/Groovy-Makes-Code-Generation-Simple-410/