Fork me on GitHub

archetype:generate

Full name:

org.apache.maven.plugins:maven-archetype-plugin:3.3.1:generate

Description:

Generates a new project from an archetype, or updates the actual project if using a partial archetype. If the project is fully generated, it is generated in a directory corresponding to its artifactId. If the project is updated with a partial archetype, it is done in the current directory.

Attributes:

  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Invokes the execution of the following lifecycle phase prior to executing itself: generate-sources.

Required Parameters

Name Type Since Description
<askForDefaultPropertyValues> Boolean - If set to true will ask for values also for properties having defaults in the first place. Only has an effect if interactiveMode is used.
Default: false
User Property: askForDefaultPropertyValues
<interactiveMode> Boolean - User settings used to check the interactiveMode.
Default: ${settings.interactiveMode}
User Property: interactiveMode

Optional Parameters

Name Type Since Description
<archetypeArtifactId> String - The archetype's artifactId.
User Property: archetypeArtifactId
<archetypeCatalog> String - The archetype catalogs to use to build a list and let the user choose from. It is a comma-separated list of one or more of the following catalog schemes
  • local which is the shortcut to the local repository
  • remote which is the shortcut for a repository with id archetype, the Maven Central repository (with id central) or the first matching mirror for either of the repository ids archetype or central
  • internal which is an internal catalog

If you want the catalog to come from a custom repository, please add a dedicated repository with id archetype and optionally a server section with the same id to your settings.xml and use the catalog scheme remote.
  <repository>
    <id>archetype</id>
    <url>https://repository.domain.com/path/to/repo/</url>
  </repository>

  <!-- in case of a repository with authentication -->
  <server>
    <id>archetype</id>
    <username>user.name</username>
    <password>s3cr3t</password>
  </server>
In order to use that repository only for resolving the catalog (and not for downloading regular Maven dependencies from it) it is recommended to include the repository in a profile which is not active by default. and explicitly select it via -P<profile-id> when this goal is called on the command-line. In case of mirrors for either repository archetype or central the matching mirror's id is considered for server settings (like authentication). If the repository's catalog file is empty or cannot be retrieved, internal catalog is transparently used as fallback.
Default: remote,local
User Property: archetypeCatalog
<archetypeGroupId> String - The archetype's groupId.
User Property: archetypeGroupId
<archetypeVersion> String - The archetype's version.
User Property: archetypeVersion
<filter> String 2.1 Applying some filter on displayed archetypes list: format is artifactId or groupId:artifactId.
  • org.apache: -> displays all archetypes which contain org.apache in groupId
  • :jee or jee -> displays all archetypes which contain jee in artifactId
  • org.apache:jee -> displays all archetypes which contain org.apache in groupId AND jee in artifactId

User Property: filter
<goals> String - Goals to immediately run on the project created from the archetype.
User Property: goals
<outputDirectory> File - No description.
Default: ${basedir}
User Property: outputDirectory

Parameter Details

<archetypeArtifactId>

The archetype's artifactId.
  • Type: java.lang.String
  • Required: No
  • User Property: archetypeArtifactId

<archetypeCatalog>

The archetype catalogs to use to build a list and let the user choose from. It is a comma-separated list of one or more of the following catalog schemes
  • local which is the shortcut to the local repository
  • remote which is the shortcut for a repository with id archetype, the Maven Central repository (with id central) or the first matching mirror for either of the repository ids archetype or central
  • internal which is an internal catalog

If you want the catalog to come from a custom repository, please add a dedicated repository with id archetype and optionally a server section with the same id to your settings.xml and use the catalog scheme remote.
  <repository>
    <id>archetype</id>
    <url>https://repository.domain.com/path/to/repo/</url>
  </repository>

  <!-- in case of a repository with authentication -->
  <server>
    <id>archetype</id>
    <username>user.name</username>
    <password>s3cr3t</password>
  </server>
In order to use that repository only for resolving the catalog (and not for downloading regular Maven dependencies from it) it is recommended to include the repository in a profile which is not active by default. and explicitly select it via -P<profile-id> when this goal is called on the command-line. In case of mirrors for either repository archetype or central the matching mirror's id is considered for server settings (like authentication). If the repository's catalog file is empty or cannot be retrieved, internal catalog is transparently used as fallback.
  • Type: java.lang.String
  • Required: No
  • User Property: archetypeCatalog
  • Default: remote,local

<archetypeGroupId>

The archetype's groupId.
  • Type: java.lang.String
  • Required: No
  • User Property: archetypeGroupId

<archetypeVersion>

The archetype's version.
  • Type: java.lang.String
  • Required: No
  • User Property: archetypeVersion

<askForDefaultPropertyValues>

If set to true will ask for values also for properties having defaults in the first place. Only has an effect if interactiveMode is used.
  • Type: java.lang.Boolean
  • Required: Yes
  • User Property: askForDefaultPropertyValues
  • Default: false

<filter>

Applying some filter on displayed archetypes list: format is artifactId or groupId:artifactId.
  • org.apache: -> displays all archetypes which contain org.apache in groupId
  • :jee or jee -> displays all archetypes which contain jee in artifactId
  • org.apache:jee -> displays all archetypes which contain org.apache in groupId AND jee in artifactId
  • Type: java.lang.String
  • Since: 2.1
  • Required: No
  • User Property: filter

<goals>

Goals to immediately run on the project created from the archetype.
  • Type: java.lang.String
  • Required: No
  • User Property: goals

<interactiveMode>

User settings used to check the interactiveMode.
  • Type: java.lang.Boolean
  • Required: Yes
  • User Property: interactiveMode
  • Default: ${settings.interactiveMode}

<outputDirectory>

No description.
  • Type: java.io.File
  • Required: No
  • User Property: outputDirectory
  • Default: ${basedir}