Avoid repetition – use archetypes

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 that extends from org.apache.maven.plugin.AbstractMojo. As each type of project has its own predefined structure, why would everyone have to build the same structure again and again? Why not start with a template? Each project can have its own template and developers can extend the template to suite their requirements. Maven archetypes address this concern. Each archetype is a project template.

We discussed Maven archetypes in detail in Chapter 7, Maven ...

Get Mastering Apache Maven 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.