Ing. Tarin Gamberini

Citazione

Standard

XHTML 1.0 Valido!

CSS Valido!

Icona di conformita' al Livello A, Linee guida 1.0 per l'Accessibilita' al Contenuto Web

Campagne

gnu/linug debian logo

Netbeans IDE logo

Use LibreOffice.org

Get Thunderbird

Get Firefox

BOINC logo

Best viewed with any browser

Sito sensibilizzato, a livello AA, ad un corretto uso della e-mail

Home > Java > How to create a Maven archetype in Netbeans

How to create a Maven archetype in Netbeans

Created Tuesday 27 settembre 2011

Table of Contents

Creating a Maven archetype

Creating a Maven archetype from an existing project is quite easy.

  1. Create your project template. This is the project as it will be created.
  2. In Netbeans right click on your project template name, choose Custom > Goals..., write in the Goals textfield the archetype:create-from-project goal and finally click OK. You can also execute the mvn archetype:create-from-project goal at command line, but be sure to type it from your project template pom directory.
  3. Now you can find the generated archetype in the target/generated-sources/ directory. Such an archetype is a Maven project itself but with the packaging type: <packaging>maven-archetype</packaging>.
  4. Open the generated archetype (double click on the generated archetype name) and edit the pom accordingly your specific needs: don't accept the pom automatically generated without having a look at it.
  5. Once it's all ok you have to install the archetype in your local Maven repository, so run mvn clean install.
  6. Create an archetypes catalog in your Maven local repository by running mvn archetype:crawl. Make sure your IDE is aware of the newly created archetype forcing a re-indexing of your Maven local repository.
  7. Finally test your archetype by creating a new project. From the Netbeans IDE right click on the Project window and choose New Project... > Maven > Project from Archetype, then select your archetype from the ones listed; or at command line simply run mvn archetype:generate -DarchetypeCatalog=local.

Reference

Copyright © 2003, 2013 Tarin Gamberini

Ultimo aggiornamento 01/11/2011