Archetype is a model that defines the
structure of project. Archetype information has different types of projects being created, folder structure and the information about projects. Maven initially generates archetype and gets all the required information about the project being done.
When
mvn archetype:generate
command is run in the command prompt for the first time, all the
plug-ins are downloaded and gives the list of archetypes and information about the application.
The inputs given to the archetype are classified into 5 types.
- Archetype
- Group ID
- Artifact ID
- Version
- Package
Archetype is the information given to Maven about the
type of project needed. Archetypes will differ based on the application to be developed. There are archetypes for J2EE applications, spring applications, hibernate applications, etc. in Maven Repository. Each archetype is a good starting point for each application.
Artifact ID is used to identify the output files like jar, war or ear files.
GroupID is an explanatory ID used to group all the artifact ID’s and gives an identification to it.
Version has default snapshots, which is a piece of code to be released.
Package is the location of source code. Based on the inputs provided, the java class in that archetype will be assigned to a Java class.