Fork me on GitHub

What is an archetype?

A Maven project 'en devenir'

I.e. an abstract representation of a kind of project that can be instantiated into a concrete customized Maven project.

An archetype knows which files will be part of the instantiated project and which properties to fill to properly customize the project.

Each archetype defines a set of common properties:

  • groupId which will be the groupId of the project
  • artifactId which will be the artifactId of the project
  • version which will be the version of the project
  • package which will be the base package for all source files of the project

A JAR file

The minimal content of the JAR file is:

.
|-- META-INF
|   `-- maven
|       `-- archetype-metadata.xml  [1]
`-- archetype-resources
    |-- ...                         [2]
    `-- pom.xml                     [3]
  1. The metadata file that defines:
    • the default values of the common properties
    • a set of additional properties with their default values
    • a set of archetype resources
  2. The resource files defined by the archetype metadata
  3. The POM file of a Maven project

Note: The common properties should be renamed to $target.groupId, ... to avoid name clash.