Fork me on GitHub

ArchetypeDescriptor

This is a reference for the Archetype descriptor used to describe archetypes's metadata.

The metadata about an archetype is stored in the archetype-metadata.xml file located in the META-INF/maven directory of its jar file.


<archetype-descriptor xmlns="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.2.0 https://maven.apache.org/xsd/archetype-descriptor-1.2.0.xsd"
  name=.. partial=.. >
  <requiredProperties>
    <requiredProperty key=.. >
      <defaultValue/>
      <validationRegex/>
    </requiredProperty>
  </requiredProperties>

  <fileSets>
    <fileSet filtered=.. packaged=.. encoding=.. includeCondition=.. >
      <directory/>
      <includes/>
      <excludes/>
    </fileSet>
  </fileSets>

  <modules>
    <module id=.. dir=.. name=.. >

      <fileSets>
        <fileSet filtered=.. packaged=.. encoding=.. includeCondition=.. >
          <directory/>
          <includes/>
          <excludes/>
        </fileSet>
      </fileSets>

      <modules>
        <module>...recursion...<module>
      </modules>
    </module>
  </modules>
</archetype-descriptor>

archetype-descriptor

No description.

Attribute Type Since Description
name String 1.0.0 Name of the Archetype, that will be displayed to the user when choosing an archetype.
partial boolean 1.0.0 Is this archetype representing a full Maven project or only parts?

Default value: false

Element Type Since Description
requiredProperties/requiredProperty* List<RequiredProperty> 1.0.0 (Many) List of required properties to generate a project from this archetype.
fileSets/fileSet* List<FileSet> 1.0.0 (Many) File sets definition.
modules/module* List<ModuleDescriptor> 1.0.0 (Many) Modules definition.

requiredProperty

Definition of a property required when generating a project from this archetype.

Attribute Type Since Description
key String 1.0.0 Key value of the property.
Element Type Since Description
defaultValue String Default value of the property.
validationRegex String 1.1.0 A regular expression used to validate the property.

fileSet

A fileset defines the way the project's files located in the jar file are used by the Archetype Plugin to generate a project. If file or directory name contains __property__ pattern, it is replaced with corresponding property value.

Attribute Type Since Description
filtered boolean 1.0.0 Filesets can be filtered, which means the selected files will be used as Velocity templates. They can be non-filtered, which means the selected files will be copied without modification.

Default value: false

packaged boolean 1.0.0 Filesets can be packaged, which means the selected files will be generated/copied in a directory structure that is prepended by the package property. They can be non-packaged, which means that the selected files will be generated/copied without that prepend.

Default value: false

encoding String 1.0.0 Encoding to use when filtering content.
includeCondition String 1.2.0 A string value that should resolve to a boolean value to conditionally include filesets. This condition should be either a boolean as String or a velocity template language statement that resolves to a boolean value. If the descriptor contains includeCondition="${shouldInclude}" and the archetype has a (required) property like shouldInclude=true the fileset is included.
Element Type Since Description
directory String 1.0.0 The directory where the files will be searched for, which is also the directory where the project's files will be generated.

Default value:

includes/include* List<String> 1.0.0 (Many) Inclusion definition "à la" Ant.
excludes/exclude* List<String> 1.0.0 (Many) Exclusion definition "à la" Ant.

module

No description.

Attribute Type Since Description
id String 1.0.0 The module's artifactId.
dir String 1.0.0 The module's directory.
name String 1.0.0 The module's name.
Element Type Since Description
fileSets/fileSet* List<FileSet> 1.0.0 (Many) File sets definition.
modules/module* List<ModuleDescriptor> 1.0.0 (Many) Modules definition.