The create goal creates a pom, the default files (source, test, resources, test-resources, site-resources), in a specific directory structure. The most basic way of using this is by calling the goal with only two expressions: the groupId and artifactId of the project to be build. For example, using
mvn archetype:create \ -DgroupId=sample.group.id \ -DartifactId=sample-artifact-id
this would create an App.java and an AppTest.java, both under the sample.group.id package. The App.java is a simple "Hello World" program while the AppTest.java is a subclass of junit.framework.TestCase that has one test which always passes.
You can also specify other parameters such as version of the project to be created, the packageName of the classes, remoteRepositories and pomRemoteRepositories (See Specifying the Remote Repositories), and the archetypeGroupId, archetypeArtifactId, and archetypeVersion.
If the version is not specified, the default will be used which is 1.0-SNAPSHOT. Also, if the packageName is not specified, the maven-archetype-plugin would derive the classes default package name based on the groupId (i.e. a groupId sample.group.id would have a default package name sample.group.id).
Moreover, if the archetypeGroupId, archetypeArtifactId and archetypeVersion is not specified (as with the example above), the default would be used, which is org.apache.maven.archetypes, maven-archetype-quickstart and 1.0-SNAPSHOT respectively.
Thus, the above command is the same as
mvn archetype:create -DgroupId=sample.group.id \ -DartifactId=sample-artifact-id \ -Dversion=1.0-SNAPSHOT \ -DpackageName=sample.group.id \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-quickstart \ -DarchetypeVersion=1.0-SNAPSHOT
But if you want to use a different archetype other than the default, you'd have to specify the following parameters: archetypeGroupId, archetypeArtifactId, and archetypeVersion.
So for example, if you wish to create a project with a groupId my.company.projects, artifactId my-project, using an archetype with an artifactId my-archetype, version 1.0-archetype-SNAPSHOT, under the groupId my.company.archetypes, you'd have to execute
mvn archetype:create \ -DgroupId=my.company.projects \ -DartifactId=my-project \ -DarchetypeGroupId=my.company.archetypes \ -DarchetypeArtifactId=my-archetype \ -DarchetypeVersion=1.0-archetype-SNAPSHOT
But if the archetype that you're going to use has an element (archetypeGroupId, archetypeArtifactId, or archetypeVersion) has the same value as that of the default, then you don't have to specify that element.
For example, if you're going to use maven-archetype-webapp version 1.0-SNAPSHOT which is in under the groupId org.apache.maven.archetypes, you can simply use the following command
mvn archetype:create -DgroupId=my.company.projects -DartifactId=another-project -DarchetypeArtifactId=maven-archetype-webapp
Builds archetype containers based from an existing Maven project (currently under development).