Maven Archetypes allow us to build archetype containers for different projects. These containers contain POM, src, test, resources, etc in a specific directory structure. The contents and the directory structure depends on the what archetype container was built.
Let’s get started.
We can use the new maven project wizard or the command line plugin options.
New >> Maven Project >> To select uncheck archetype selection.
There are several archetype containers available that we can use depending on the type of project we trying to build.
We can select an Archetype the best fits the project.
In this step, we can select the archetype. For example,
An archetype which contains a sample maven project.
An archetype which contains a sample Maven web app project.
An archetype which contains a simplified sample J2EE application.
This builds the corresponding project structure for us to get started with our new project. It generates the desired project structure depending on the application that we try to build with our selection.
Using Command Line
We can also do this via command line using maven archetype plugin:
To create a simple java application we can use the following command as shown below:
mvn archetype:create -DgroupId=[project_group_id] -DartifactId=[project_artifact_id] -DarchetypeArtifactId=maven-archetype-quickstart