Thursday, February 14, 2013

maven archetype catalog

I was playing around with tapestry and when I try to do a quick start as of today the number of archetypes that maven shows is about 726 and I didn't know what number to pick.  Then I realised that I can filter the list after the initial listing.

726: remote -> uk.ac.rdg.resc:edal-ncwms-based-webapp (-)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 251: org.apache.tapestry:quickstart
Choose archetype:
1: remote -> org.apache.tapestry:quickstart (-)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose org.apache.tapestry:quickstart version:

I already know how to use the archetype:create if I know the archetype details as below:
mvn archetype:create -DarchetypeArtifactId=quickstart -DarchetypeGroupId=org.apache.tapestry -DarchetypeVersion=5.3.6 -DartifactId=quickstart -DgroupId=com.phani -Dversion=1.0 -DpackageName=com.phani.quickstart

We have few interesting options with archetype:generate -DarchetypeCatalog=??? as below (source):
archetypeCatalog:
The archetype catalogs to use to build a list and let the user choose from. It is a comma separated list of catalogs. Catalogs use following schemes:
  • 'file://...' with archetype-catalog.xml automatically appended when pointing to a directory
  • 'http://...' or 'https://...' with archetype-catalog.xml always appended
  • 'local' which is the shortcut for 'file://~/.m2/archetype-catalog.xml'
  • 'remote' which is the shortcut for Maven Central repository, ie 'http://repo1.maven.org/maven2'
  • 'internal' which is an internal catalog
For tapestry we can say
mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org

No comments:

Post a Comment