Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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 Archetypes.