Avoiding 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, 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 ...

Get Maven Essentials 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.