PluginDescriptor

Maven 4 Plugin descriptor, stored in META-INF/maven/plugin.xml in a plugin's jar artifact. This descriptor is generally using the information contained in the annotations of the plugin api.

An XSD is available at https://maven.apache.org/xsd/plugin-2.0.0.xsd

<plugin xmlns="http://maven.apache.org/PLUGIN/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/PLUGIN/2.0.0 https://maven.apache.org/xsd/plugin-2.0.0.xsd">
  <name/>
  <description/>
  <groupId/>
  <artifactId/>
  <version/>
  <goalPrefix/>
  <isolatedRealm/>
  <inheritedByDefault/>
  <requiredJavaVersion/>
  <requiredMavenVersion/>

  <mojos>
    <mojo>
      <goal/>
      <description/>
      <implementation/>
      <language/>
      <phase/>
      <executePhase/>
      <executeGoal/>
      <executeLifecycle/>
      <dependencyResolution/>
      <dependencyCollection/>
      <directInvocationOnly/>
      <projectRequired/>
      <onlineRequired/>
      <aggregator/>
      <inheritedByDefault/>
      <since/>
      <deprecated/>
      <configurator/>

      <parameters>
        <parameter>
          <name/>
          <alias/>
          <type/>
          <required/>
          <editable/>
          <description/>
          <since/>
          <deprecated/>
          <expression/>
          <defaultValue/>
        </parameter>
      </parameters>
      <id/>
      <fullGoalName/>
    </mojo>
  </mojos>
</plugin>

plugin

Root element of the plugin.xml file.

Element Type Description
name String Name of the plugin.
description String Description of the plugin.
groupId String The group id of the plugin.
artifactId String The artifact id of the plugin.
version String The version of the plugin.
goalPrefix String
isolatedRealm boolean

Default value: false

inheritedByDefault boolean

Default value: true

requiredJavaVersion String A version range which specifies the supported Java versions. A version range can either use the usual mathematical syntax "[2.0.10,2.1.0),[3.0,)" or use a single version "2.2.1". The latter is a short form for "[2.2.1,)", i.e. denotes the minimum version required.

Since: Maven 4.0.0-alpha-3

requiredMavenVersion String A version range which specifies the supported Maven versions. A version range can either use the usual mathematical syntax "[2.0.10,2.1.0),[3.0,)" or use a single version "2.2.1". The latter is a short form for "[2.2.1,)", i.e. denotes the minimum version required. This value takes precedence over the POMs Maven prerequisite.

Since: Maven 4.0.0-alpha-3

mojos/mojo* List<MojoDescriptor> (Many) Description of each Mojo provided by the plugin.

mojo

A Mojo description.

Element Type Description
goal String The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly, or inside a POM in order to provide Mojo-specific configuration.
description String The description of this Mojo's functionality.
implementation String The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
language String The implementation language for this Mojo (java, beanshell, etc.).

Default value: java

phase String Defines a default phase to bind a Mojo execution to if the user does not explicitly set a phase in the POM.

Note: This will not automagically make a Mojo run when the plugin declaration is added to the POM. It merely enables the user to omit the element from the surrounding element.

executePhase String Reference the invocation phase of the Mojo.
executeGoal String Reference the invocation goal of the Mojo.
executeLifecycle String
dependencyResolution String Flags this Mojo as requiring the dependencies in the specified class path to be resolved before it can execute: compile, runtime, test, compile+runtime (since Maven 3.0) or runtime+system (since Maven 3.0)

Default value: runtime

dependencyCollection String Flags this Mojo as requiring information about the dependencies that would make up the specified class path. As the name suggests, this is similar to requiresDependencyResolution and supports the same values. The important difference is this will not resolve the files for the dependencies, i.e. the artifacts associated with a Maven project can lack a file. As such, this annotation is meant for Mojos that only want to analyze the set of transitive dependencies, in particular during early lifecycle phases where full dependency resolution might fail due to projects which haven't been built yet.
directInvocationOnly boolean Flags this Mojo to be invoked directly only.

Default value: false

projectRequired boolean Flags this Mojo to require running inside of a project.

Default value: true

onlineRequired boolean Flags this Mojo to require online mode for its operation.

Default value: false

aggregator boolean Flags this Mojo to run it in a multi-module way, i.e. aggregate the build with the set of projects listed as modules.

Default value: false

inheritedByDefault boolean Specify that the Mojo is inherited.

Default value: true

since String Specify the version when the Mojo was added to the API. Similar to Javadoc since.
deprecated String Description with the reason of Mojo deprecation. Similar to Javadoc @deprecated This will trigger a warning when a user tries to use a Mojo marked as deprecated.
configurator String The configurator type to use when injecting parameter values into this Mojo. The value is normally deduced from the Mojo's implementation language, but can be specified to allow a custom ComponentConfigurator implementation to be used.
parameters/parameter* List<Parameter> (Many)
id String the id of the mojo, based on the goal name
fullGoalName String the full goal name

parameter

A phase mapping definition.

Element Type Description
name String The name of the parameter, to be used while configuring this parameter from the Mojo's declared defaults or from the POM.
alias String Specifies an alias which can be used to configure this parameter from the POM. This is primarily useful to improve user-friendliness, where Mojo field names are not intuitive to the user or are otherwise not conducive to configuration via the POM.
type String The Java type for this parameter. This is used to validate the result of any expressions used to calculate the value which should be injected into the Mojo for this parameter.
required boolean Whether this parameter is required for the Mojo to function. This is used to validate the configuration for a Mojo before it is injected, and before the Mojo is executed from some half-state.

Default value: false

editable boolean Specifies that this parameter can be configured directly by the user (as in the case of POM-specified configuration). This is useful when you want to force the user to use common POM elements rather than plugin configurations, as in the case where you want to use the artifact's final name as a parameter. In this case, you want the user to modify rather than specifying a value for finalName directly in the plugin configuration section. It is also useful to ensure that - for example - a List-typed parameter which expects items of type Artifact doesn't get a List full of Strings.

Default value: true

description String The description of this parameter's use inside the Mojo.
since String Specify the version when the parameter was added to the API. Similar to Javadoc since.
deprecated String Description with the reason of parameter deprecation. Similar to Javadoc @deprecated. This will trigger a warning when a user tries to configure a parameter marked as deprecated.
expression String Parameter expression, to let user override default value with a user property, system property or project property.
defaultValue String The default value, as an expression that will be evaluated at injection or run-time.