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.
I'd like to simplify and enhance the co-operation between NetBeans and Maven archetypes. I'd like to create a system where one can declaratively describe a project template (consisting of a reference to Maven archetype and a UI to configure it) and register it in the IDE. No (or minimum) of Java code required to do so. There already is [@TemplateRegistration](http://bits.netbeans.org/8.1/javadoc/org-netbeans-api-templates/org/netbeans/api/templates/TemplateRegistration.html) which supports declarative (via HTML) UI. However as of 8.2 it works only for file based templates - I'd like to enhance it to work with project templates as well.
Created attachment 162627 [details] Initial sketch of how the support could work I am trying to change the existing HTML UI Wizard to use the new FileBuilder API instead of direct DataObject.createFromTemplate - Sváťo, I hope that is move towards right direction. The Maven project implements CreateFromTemplateHandler which recognizes property like files with extension ".archetype" that contain information like artifactId, groupId, version of the archetype and when instantiated they use "mvn" to create the project. Tomáši, is it OK approach? I suffer writing tests. I am not sure if anyone tried to test instantiation of a maven archetype in a unit test. There are tons of problematic dependencies.
> The Maven project implements CreateFromTemplateHandler which recognizes property like files with extension ".archetype" > that contain information like artifactId, groupId, version of the archetype > and when instantiated they use "mvn" to create the project. Tomáši, is it OK approach? no objections > I suffer writing tests. I am not sure if anyone tried to test instantiation of a maven archetype in a unit test. There are tons of problematic dependencies. hm, when run from tests inputouput returns IOProvider.TrivialOW which runs into stactraceoverflow and mavenExecutor can't determine the maven executable home dir properly ... invoking via NbModuleSuite.createConfiguration(...) isn't an option?
(In reply to Tomas Stupka from comment #2) > hm, when run from tests inputouput returns IOProvider.TrivialOW which runs > into stactraceoverflow and mavenExecutor can't determine the maven > executable home dir properly ... > invoking via NbModuleSuite.createConfiguration(...) isn't an option? I tried it, but then the layer generated by the test isn't found and maybe there were other problems. In the current version I replaced it with MockExecuteMaven, where I can just simulate what real Maven would do.
Cleaned-up version that contains simple test that mocks the call into "mvn archetype": http://hg.netbeans.org/ergonomics/rev/76d9cafcee35
Here is the documentation for the "UI for Maven Archetype" feature: http://hg.netbeans.org/ergonomics/rev/ae57f97b7285
Here is a bit more test coverage: https://hg.netbeans.org/ergonomics/rev/580eb081e506 Unless there are objections, I will merge tomorrow.
Merged as http://hg.netbeans.org/ergonomics/rev/dc9f6a45afa9
Integrated into 'main-silver', will be available in build *201611020002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/76d9cafcee35 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #268677: Recognizing .archetype template files and using them to instantiate projects via mvn archetype
Integrated into 'main-silver', will be available in build *201611060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/34963a717456 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #268677: Fixing broken link reference and adding apichanges note about the new Maven Archetype UI