Fork me on GitHub

Maven Archetype Packaging

This is 'maven-archetype' packaging configuration for archetype projects. It provides maven-archetype-plugin bindings to default lifecycle:

in addition to classical resource/jar/install/deploy. See Archetype Packaging Reference for details.

Usage

Declaring maven-archetype packaging to your pom is not the only step required:

  • to be available from an the archetype project, the packaging must be added as an extension,
  • to ensure a reproducible build, the archetype plugin version needs to be locked down in pluginManagement section.

Typical pom.xml contains:

<project>
  ...
  <packaging>maven-archetype</packaging>
  ...
  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.archetype</groupId>
        <artifactId>archetype-packaging</artifactId>
        <version>3.2.1</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-archetype-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>