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                              \                        \ 

this would create an and an, both under the package. The is a simple "Hello World" program while the 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 would have a default package name

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                                                 \
  -DartifactId=sample-artifact-id                  \
  -Dversion=1.0-SNAPSHOT                           \                    \
  -DarchetypeGroupId=org.apache.maven.archetypes   \
  -DarchetypeArtifactId=maven-archetype-quickstart \

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, artifactId my-project, using an archetype with an artifactId my-archetype, version 1.0-archetype-SNAPSHOT, under the groupId, you'd have to execute

mvn archetype:create                               \                    \
  -DartifactId=my-project                          \         \
  -DarchetypeArtifactId=my-archetype               \

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

Create From Project

Builds archetype containers based from an existing Maven project (currently under development).