Class MojoDescriptor
java.lang.Object
org.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
org.apache.maven.plugin.descriptor.MojoDescriptor
- All Implemented Interfaces:
Cloneable
public class MojoDescriptor
extends org.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
implements Cloneable
The bean containing the Mojo descriptor.
For more information about the usage tag, have a look to: https://maven.apache.org/developers/mojo-api-specification.html TODO is there a need for the delegation of MavenMojoDescriptor to this? Why not just extend ComponentDescriptor here?
For more information about the usage tag, have a look to: https://maven.apache.org/developers/mojo-api-specification.html TODO is there a need for the delegation of MavenMojoDescriptor to this? Why not just extend ComponentDescriptor here?
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Flags this Mojo to run it in a multi module way, i.e.private static final String
private static final String
private String
The scope of (transitive) dependencies that should be collected but not resolved.private String
Specify the required dependencies in a specified scopeprivate String
Description with reason of Mojo deprecation.private boolean
By default, the Mojo cannot be invoked directlyprivate String
Reference the invocation goal of the Mojo.private String
Reference the invocation lifecycle of the Mojo.private String
Reference the invocation phase of the Mojo.private String
By default, the execution strategy is "once-per-session"private 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.private boolean
By default, the Mojo is inheritedstatic final String
The Plexus component typeprivate org.codehaus.plexus.configuration.PlexusConfiguration
Plugin configurationstatic final String
"always" execution strategyprivate boolean
By default, the Mojo is assumed to work offline as wellprivate String
Defines a default phase to bind a mojo execution to if the user does not explicitly set a phase in the POM.private PluginDescriptor
Plugin descriptorprivate boolean
By default, the Mojo needs a Maven project to be executedprivate boolean
By default, the Mojo don't need reports to runprivate String
Specify the version when the Mojo was added to the API.static final String
"once-per-session" execution strategyprivate boolean
By default, mojos are not threadsafe -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(Parameter parameter) boolean
clone()
Creates a shallow copy of this mojo descriptor.private boolean
compareObjects
(Object first, Object second) boolean
Gets the scope of (transitive) dependencies that should be collected.getGoal()
getId()
org.codehaus.plexus.configuration.PlexusConfiguration
getPhase()
getRole()
getSince()
int
hashCode()
boolean
Deprecated.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
setAggregator
(boolean aggregator) void
setDependencyCollectionRequired
(String requiresDependencyCollection) void
setDependencyResolutionRequired
(String requiresDependencyResolution) void
setDeprecated
(String deprecated) void
setDirectInvocationOnly
(boolean directInvocationOnly) void
setExecuteGoal
(String executeGoal) void
setExecuteLifecycle
(String executeLifecycle) void
setExecutePhase
(String executePhase) void
setExecutionStrategy
(String executionStrategy) void
void
setInheritedByDefault
(boolean inheritedByDefault) void
setLanguage
(String language) void
setMojoConfiguration
(org.codehaus.plexus.configuration.PlexusConfiguration mojoConfiguration) void
setOnlineRequired
(boolean requiresOnline) void
setParameters
(List<Parameter> parameters) void
void
setPluginDescriptor
(PluginDescriptor pluginDescriptor) void
setProjectRequired
(boolean requiresProject) void
setRequiresReports
(boolean requiresReports) void
void
setThreadSafe
(boolean threadSafe) Methods inherited from class org.codehaus.plexus.component.repository.ComponentDescriptor
addRequirement, getAlias, getComponentComposer, getComponentConfigurator, getComponentFactory, getComponentProfile, getConfiguration, getDescription, getHumanReadableKey, getImplementation, getImplementationClass, getInstantiationStrategy, getLifecycleHandler, getRealm, getRequirements, getRoleClass, getVersion, hasConfiguration, isIsolatedRealm, setAlias, setComponentComposer, setComponentConfigurator, setComponentFactory, setComponentProfile, setComponentType, setConfiguration, setDescription, setImplementation, setImplementationClass, setInstantiationStrategy, setIsolatedRealm, setLifecycleHandler, setRealm, setRole, setRoleClass, setRoleHint, setVersion, toString
-
Field Details
-
MAVEN_PLUGIN
The Plexus component type- See Also:
-
SINGLE_PASS_EXEC_STRATEGY
"once-per-session" execution strategy- See Also:
-
MULTI_PASS_EXEC_STRATEGY
"always" execution strategy- See Also:
-
DEFAULT_INSTANTIATION_STRATEGY
- See Also:
-
DEFAULT_LANGUAGE
- See Also:
-
parameters
-
parameterMap
-
executionStrategy
By default, the execution strategy is "once-per-session" -
goal
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. -
phase
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<phase>
element from the surrounding<execution>
element. -
since
Specify the version when the Mojo was added to the API. Similar to Javadoc since. -
executePhase
Reference the invocation phase of the Mojo. -
executeGoal
Reference the invocation goal of the Mojo. -
executeLifecycle
Reference the invocation lifecycle of the Mojo. -
deprecated
Description with reason of Mojo deprecation. Similar to Javadoc@deprecated
. This will trigger a warning when a user tries to use a Mojo marked as deprecated. -
aggregator
private boolean aggregatorFlags this Mojo to run it in a multi module way, i.e. aggregate the build with the set of projects listed as modules. By default, no need to aggregate the Maven project and its child modules -
dependencyResolutionRequired
Specify the required dependencies in a specified scope -
dependencyCollectionRequired
The scope of (transitive) dependencies that should be collected but not resolved.- Since:
- 3.0-alpha-3
-
projectRequired
private boolean projectRequiredBy default, the Mojo needs a Maven project to be executed -
onlineRequired
private boolean onlineRequiredBy default, the Mojo is assumed to work offline as well -
mojoConfiguration
private org.codehaus.plexus.configuration.PlexusConfiguration mojoConfigurationPlugin configuration -
pluginDescriptor
Plugin descriptor -
inheritedByDefault
private boolean inheritedByDefaultBy default, the Mojo is inherited -
directInvocationOnly
private boolean directInvocationOnlyBy default, the Mojo cannot be invoked directly -
requiresReports
private boolean requiresReportsBy default, the Mojo don't need reports to run -
threadSafe
private boolean threadSafeBy default, mojos are not threadsafe- Since:
- 3.0-beta-2
-
-
Constructor Details
-
MojoDescriptor
public MojoDescriptor()Default constructor.
-
-
Method Details
-
getLanguage
- Returns:
- the language of this Mojo, i.e.
java
-
setLanguage
- Parameters:
language
- the new language
-
getDeprecated
- Returns:
- Description with reason of a Mojo deprecation.
-
setDeprecated
- Parameters:
deprecated
- Description with reason of a Mojo deprecation.
-
getParameters
- Returns:
- the list of parameters
-
setParameters
- Parameters:
parameters
- the new list of parameters- Throws:
DuplicateParameterException
- if any
-
addParameter
- Parameters:
parameter
- add a new parameter- Throws:
DuplicateParameterException
- if any
-
getParameterMap
- Returns:
- the list parameters as a Map
-
setDependencyResolutionRequired
- Parameters:
requiresDependencyResolution
- the new required dependencies in a specified scope
-
getDependencyResolutionRequired
-
isDependencyResolutionRequired
Deprecated.- Returns:
- the required dependencies in a specified scope TODO the name is not intelligible
-
setDependencyCollectionRequired
- Since:
- 3.0-alpha-3
-
getDependencyCollectionRequired
Gets the scope of (transitive) dependencies that should be collected. Dependency collection refers to the process of calculating the complete dependency tree in terms of artifact coordinates. In contrast to dependency resolution, this does not include the download of the files for the dependency artifacts. It 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.- Returns:
- The scope of (transitive) dependencies that should be collected or
null
if none. - Since:
- 3.0-alpha-3
-
setProjectRequired
public void setProjectRequired(boolean requiresProject) - Parameters:
requiresProject
-true
if the Mojo needs a Maven project to be executed,false
otherwise.
-
isProjectRequired
public boolean isProjectRequired()- Returns:
true
if the Mojo needs a Maven project to be executed,false
otherwise.
-
setOnlineRequired
public void setOnlineRequired(boolean requiresOnline) - Parameters:
requiresOnline
-true
if the Mojo is online,false
otherwise.
-
isOnlineRequired
public boolean isOnlineRequired()- Returns:
true
if the Mojo is online,false
otherwise.
-
requiresOnline
public boolean requiresOnline()- Returns:
true
if the Mojo is online,false
otherwise.
-
getPhase
- Returns:
- the binded phase name of the Mojo
-
setPhase
- Parameters:
phase
- the new binded phase name of the Mojo
-
getSince
- Returns:
- the version when the Mojo was added to the API
-
setSince
- Parameters:
since
- the new version when the Mojo was added to the API
-
getGoal
- Returns:
- The goal name of the Mojo
-
setGoal
- Parameters:
goal
- The new goal name of the Mojo
-
getExecutePhase
- Returns:
- the invocation phase of the Mojo
-
setExecutePhase
- Parameters:
executePhase
- the new invocation phase of the Mojo
-
alwaysExecute
public boolean alwaysExecute()- Returns:
true
if the Mojo usesalways
for theexecutionStrategy
-
getExecutionStrategy
- Returns:
- the execution strategy
-
setExecutionStrategy
- Parameters:
executionStrategy
- the new execution strategy
-
getMojoConfiguration
public org.codehaus.plexus.configuration.PlexusConfiguration getMojoConfiguration()- Returns:
- the mojo configuration
-
setMojoConfiguration
public void setMojoConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration mojoConfiguration) - Parameters:
mojoConfiguration
- a new mojo configuration
-
getRole
- Overrides:
getRole
in classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getRoleHint
- Overrides:
getRoleHint
in classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getId
- Returns:
- the id of the mojo, based on the goal name
-
getFullGoalName
- Returns:
- the full goal name
- See Also:
-
getComponentType
- Overrides:
getComponentType
in classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getPluginDescriptor
- Returns:
- the plugin descriptor
-
setPluginDescriptor
- Parameters:
pluginDescriptor
- the new plugin descriptor
-
isInheritedByDefault
public boolean isInheritedByDefault()- Returns:
true
if the Mojo is inherited,false
otherwise.
-
setInheritedByDefault
public void setInheritedByDefault(boolean inheritedByDefault) - Parameters:
inheritedByDefault
-true
if the Mojo is inherited,false
otherwise.
-
equals
- Overrides:
equals
in classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
compareObjects
-
hashCode
public int hashCode()- Overrides:
hashCode
in classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getExecuteLifecycle
- Returns:
- the invocation lifecycle of the Mojo
-
setExecuteLifecycle
- Parameters:
executeLifecycle
- the new invocation lifecycle of the Mojo
-
setAggregator
public void setAggregator(boolean aggregator) - Parameters:
aggregator
-true
if the Mojo uses the Maven project and its child modules,false
otherwise.
-
isAggregator
public boolean isAggregator()- Returns:
true
if the Mojo uses the Maven project and its child modules,false
otherwise.
-
isDirectInvocationOnly
public boolean isDirectInvocationOnly()- Returns:
true
if the Mojo cannot be invoked directly,false
otherwise.
-
setDirectInvocationOnly
public void setDirectInvocationOnly(boolean directInvocationOnly) - Parameters:
directInvocationOnly
-true
if the Mojo cannot be invoked directly,false
otherwise.
-
isRequiresReports
public boolean isRequiresReports()- Returns:
true
if the Mojo needs reports to run,false
otherwise.
-
setRequiresReports
public void setRequiresReports(boolean requiresReports) - Parameters:
requiresReports
-true
if the Mojo needs reports to run,false
otherwise.
-
setExecuteGoal
- Parameters:
executeGoal
- the new invocation goal of the Mojo
-
getExecuteGoal
- Returns:
- the invocation goal of the Mojo
-
isThreadSafe
public boolean isThreadSafe()- Returns:
- True if the
Mojo
is thread-safe and can be run safely in parallel - Since:
- 3.0-beta-2
-
setThreadSafe
public void setThreadSafe(boolean threadSafe) - Parameters:
threadSafe
- indicates that the mojo is thread-safe and can be run safely in parallel- Since:
- 3.0-beta-2
-
isForking
public boolean isForking()- Returns:
true
if this mojo forks either a goal or the lifecycle,false
otherwise.
-
clone
Creates a shallow copy of this mojo descriptor.
-