When we create a Java project, we need to structure it in different ways based on the type of the project. If it's a Java EE web application then we need to have a WEB-INF directory and a web.xml
file. If it's a Maven plugin project, we need to have a Mojo class, which extends from org.apache.maven.plugin.AbstractMojo
. Since each type of project has its own predefined structure, why would everyone have to build the same structure again and again? Why don't we start with a template? Each project can have its own template and the developers can extend the template to suit their requirements. Maven archetypes address this concern. Each archetype is a project template.
We discussed Maven archetypes in detail, in Chapter 3, Maven Archetypes.