PluginDescriptor
Plugin descriptor, stored in META-INF/maven/plugin.xml in a plugin's jar artifact. This descriptor is generally generated from plugin sources, using maven-plugin-plugin.
<plugin xmlns="http://maven.apache.org/PLUGIN/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/PLUGIN/1.0.0 http://maven.apache.org/xsd/plugin-1.0.0.xsd"> <description/> <groupId/> <artifactId/> <version/> <goalPrefix/> <isolatedRealm/> <inheritedByDefault/> <mojos> <mojo> <goal/> <description/> <implementation/> <language/> <phase/> <executePhase/> <executeGoal/> <executeLifecycle/> <requiresDependencyResolution/> <requiresDependencyCollection/> <requiresDirectInvocation/> <requiresProject/> <requiresReports/> <requiresOnline/> <aggregator/> <inheritedByDefault/> <threadSafe/> <instantiationStrategy/> <executionStrategy/> <since/> <deprecated/> <configurator/> <composer/> <parameters> <parameter> <name/> <alias/> <type/> <required/> <editable/> <implementation/> <description/> <since/> <deprecated/> </parameter> </parameters> <configuration> <paramName implementation=.. default-value=.. /> </configuration> <requirements> <requirement> <role/> <role-hint/> <field-name/> </requirement> </requirements> </mojo> </mojos> <dependencies> <dependency> <groupId/> <artifactId/> <version/> <type/> </dependency> </dependencies> </plugin>
plugin
Root element of the plugin.xml file.
Element | Type | Description |
---|---|---|
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 is: false. |
inheritedByDefault | boolean | Default value is: true. |
mojos/mojo* | List<MojoDescriptor> | (Many) Description of each Mojo provided by the plugin. |
dependencies/dependency* | List<Dependency> | (Many) A set of dependencies which the plugin requires in order to function. This enables the plugin to function independently of its POM (or at least to declare the libraries it needs to run). |
mojo
A Mojo description.
Element | Type | Description |
---|---|---|
goal | String | The 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 is: 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 annotation will not automagically make a mojo run when the plugin declaration is added to the POM. It merely enables the user to omit the <phase> element from the surrounding <execution> element. |
executePhase | String | |
executeGoal | String | |
executeLifecycle | String | |
requiresDependencyResolution | 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)
Default value is: runtime. |
requiresDependencyCollection | 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. |
requiresDirectInvocation | boolean | Flags this Mojo to be invoked directly. Default value is: false. |
requiresProject | boolean | Flags this Mojo to run inside of a project. Default value is: true. |
requiresReports | boolean | Flags this Mojo to require reports. Unsupported since Maven 3.0. Default value is: false. |
requiresOnline | boolean | Flags this Mojo to require online mode for its operation. Default value is: 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 is: false. |
inheritedByDefault | boolean | Specify that the Mojo is inherited. Default value is: true. |
threadSafe | boolean |
Marks this mojo as being thread-safe, i.e. the mojo safely supports concurrent execution during parallel
builds. Mojos without this annotation will make Maven output a warning when used during a parallel build
session. Since Maven 3.0.
Default value is: false. |
instantiationStrategy | String | Specify the instantiation strategy. Default value is: per-lookup. |
executionStrategy | String | Specify the execution strategy: once-per-session, always. |
since | String | Specify the version when the Mojo was added to the API. Similar to Javadoc since. |
deprecated | String | Specify the version when the Mojo was deprecated to the API. Similar to Javadoc deprecated. This will trigger a warning when a user tries to configure a parameter 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. |
composer | String | |
parameters/parameter* | List<Parameter> | (Many) |
configuration/paramName* | List<Configuration> | (Many) |
requirements/requirement* | List<Requirement> | (Many) |
parameter
A phase mapping definition.
Element | Type | Description |
---|---|---|
name | String | The name of the parameter, to be used in 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 is: false. |
editable | boolean |
Specifies that this parameter cannot 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 <build><finalName/></build> 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 is: true. |
implementation | String | |
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 | Specify the version when the parameter was deprecated to the API. Similar to Javadoc deprecated. This will trigger a warning when a user tries to configure a parameter marked as deprecated. |
paramName
A parameter configuration.
Element Content: Parameter expression.
Attribute | Type | Description |
---|---|---|
implementation | String | |
default-value | String |
dependency
Definition of a dependency, needed by the plugin at runtime.
Element | Type | Description |
---|---|---|
groupId | String | The group id of the dependency. |
artifactId | String | The artifact id of the dependency. |
version | String | The version of the dependency. |
type | String | The type of dependency. Default value is: jar. |