Maven Archetype Installation

Azad picture Azad · Dec 10, 2011 · Viewed 12.8k times · Source

I wana configure a Java EE project with primefaces. I read somewhere that I can create a project structure with mvn arechetype:generate. When I used that I just saw 41 options while in that tutorial that command shows more than three hundred options. When I searched about it, I found that I should install new arechtypes in my Maven installation. but I don't know how! Do someone know how I can add (or install) my desired archetypes in my Maven installation?

Answer

domi picture domi · Dec 10, 2011

installing an archetype is no different then any other artifact, just use:

$> mvn install

after this your already able generate a new project from the new archetype (although you have to define all the details on the command line - e.g. groupId, artifactId, version...). But if you would like to have it also in the local archetype catalog, then use

$> mvn install archetype:update-local-catalog

If you already have other archetypes in your local repo which are not in your catalog, you can use 'archetype:crawl'.

saying this, please make sure to use 'maven-archetype' as your packaging type, this will ease the crawling of new archetypes. see also: http://maven.apache.org/archetype/maven-archetype-plugin/faq.html