Class MojoDescriptor
- java.lang.Object
-
- org.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
- org.apache.maven.plugin.descriptor.MojoDescriptor
-
- All Implemented Interfaces:
java.lang.Cloneable
public class MojoDescriptor extends org.codehaus.plexus.component.repository.ComponentDescriptor<Mojo> implements java.lang.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?
-
-
Field Summary
Fields Modifier and Type Field Description private booleanaggregatorFlags this Mojo to run it in a multi module way, i.e.private static java.lang.StringDEFAULT_INSTANTIATION_STRATEGYprivate static java.lang.StringDEFAULT_LANGUAGEprivate java.lang.StringdependencyCollectionRequiredThe scope of (transitive) dependencies that should be collected but not resolved.private java.lang.StringdependencyResolutionRequiredSpecify the required dependencies in a specified scopeprivate java.lang.StringdeprecatedSpecify the version when the Mojo was deprecated to the API.private booleandirectInvocationOnlyBy default, the Mojo cannot be invoked directlyprivate java.lang.StringexecuteGoalReference the invocation goal of the Mojo.private java.lang.StringexecuteLifecycleReference the invocation lifecycle of the Mojo.private java.lang.StringexecutePhaseReference the invocation phase of the Mojo.private java.lang.StringexecutionStrategyBy default, the execution strategy is "once-per-session"private java.lang.StringgoalThe 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 booleaninheritedByDefaultBy default, the Mojo is inheritedstatic java.lang.StringMAVEN_PLUGINThe Plexus component typeprivate org.codehaus.plexus.configuration.PlexusConfigurationmojoConfigurationPlugin configurationstatic java.lang.StringMULTI_PASS_EXEC_STRATEGY"always" execution strategyprivate booleanonlineRequiredBy default, the Mojo is assumed to work offline as wellprivate java.util.Map<java.lang.String,Parameter>parameterMapprivate java.util.List<Parameter>parametersprivate java.lang.StringphaseDefines a default phase to bind a mojo execution to if the user does not explicitly set a phase in the POM.private PluginDescriptorpluginDescriptorPlugin descriptorprivate booleanprojectRequiredBy default, the Mojo needs a Maven project to be executedprivate booleanrequiresReportsBy default, the Mojo don't need reports to runprivate java.lang.StringsinceSpecify the version when the Mojo was added to the API.static java.lang.StringSINGLE_PASS_EXEC_STRATEGY"once-per-session" execution strategyprivate booleanthreadSafeBy default, mojos are not threadsafe
-
Constructor Summary
Constructors Constructor Description MojoDescriptor()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddParameter(Parameter parameter)booleanalwaysExecute()MojoDescriptorclone()Creates a shallow copy of this mojo descriptor.private booleancompareObjects(java.lang.Object first, java.lang.Object second)booleanequals(java.lang.Object object)java.lang.StringgetComponentType()java.lang.StringgetDependencyCollectionRequired()Gets the scope of (transitive) dependencies that should be collected.java.lang.StringgetDependencyResolutionRequired()java.lang.StringgetDeprecated()java.lang.StringgetExecuteGoal()java.lang.StringgetExecuteLifecycle()java.lang.StringgetExecutePhase()java.lang.StringgetExecutionStrategy()java.lang.StringgetFullGoalName()java.lang.StringgetGoal()java.lang.StringgetId()java.lang.StringgetLanguage()org.codehaus.plexus.configuration.PlexusConfigurationgetMojoConfiguration()java.util.Map<java.lang.String,Parameter>getParameterMap()java.util.List<Parameter>getParameters()java.lang.StringgetPhase()PluginDescriptorgetPluginDescriptor()java.lang.StringgetRole()java.lang.StringgetRoleHint()java.lang.StringgetSince()inthashCode()booleanisAggregator()java.lang.StringisDependencyResolutionRequired()Deprecated.booleanisDirectInvocationOnly()booleanisForking()booleanisInheritedByDefault()booleanisOnlineRequired()booleanisProjectRequired()booleanisRequiresReports()booleanisThreadSafe()booleanrequiresOnline()voidsetAggregator(boolean aggregator)voidsetDependencyCollectionRequired(java.lang.String requiresDependencyCollection)voidsetDependencyResolutionRequired(java.lang.String requiresDependencyResolution)voidsetDeprecated(java.lang.String deprecated)voidsetDirectInvocationOnly(boolean directInvocationOnly)voidsetExecuteGoal(java.lang.String executeGoal)voidsetExecuteLifecycle(java.lang.String executeLifecycle)voidsetExecutePhase(java.lang.String executePhase)voidsetExecutionStrategy(java.lang.String executionStrategy)voidsetGoal(java.lang.String goal)voidsetInheritedByDefault(boolean inheritedByDefault)voidsetLanguage(java.lang.String language)voidsetMojoConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration mojoConfiguration)voidsetOnlineRequired(boolean requiresOnline)voidsetParameters(java.util.List<Parameter> parameters)voidsetPhase(java.lang.String phase)voidsetPluginDescriptor(PluginDescriptor pluginDescriptor)voidsetProjectRequired(boolean requiresProject)voidsetRequiresReports(boolean requiresReports)voidsetSince(java.lang.String since)voidsetThreadSafe(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 Detail
-
MAVEN_PLUGIN
public static final java.lang.String MAVEN_PLUGIN
The Plexus component type- See Also:
- Constant Field Values
-
SINGLE_PASS_EXEC_STRATEGY
public static final java.lang.String SINGLE_PASS_EXEC_STRATEGY
"once-per-session" execution strategy- See Also:
- Constant Field Values
-
MULTI_PASS_EXEC_STRATEGY
public static final java.lang.String MULTI_PASS_EXEC_STRATEGY
"always" execution strategy- See Also:
- Constant Field Values
-
DEFAULT_INSTANTIATION_STRATEGY
private static final java.lang.String DEFAULT_INSTANTIATION_STRATEGY
- See Also:
- Constant Field Values
-
DEFAULT_LANGUAGE
private static final java.lang.String DEFAULT_LANGUAGE
- See Also:
- Constant Field Values
-
parameters
private java.util.List<Parameter> parameters
-
parameterMap
private java.util.Map<java.lang.String,Parameter> parameterMap
-
executionStrategy
private java.lang.String executionStrategy
By default, the execution strategy is "once-per-session"
-
goal
private java.lang.String 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
private java.lang.String 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
private java.lang.String since
Specify the version when the Mojo was added to the API. Similar to Javadoc since.
-
executePhase
private java.lang.String executePhase
Reference the invocation phase of the Mojo.
-
executeGoal
private java.lang.String executeGoal
Reference the invocation goal of the Mojo.
-
executeLifecycle
private java.lang.String executeLifecycle
Reference the invocation lifecycle of the Mojo.
-
deprecated
private java.lang.String deprecated
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.
-
aggregator
private boolean aggregator
Flags 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
private java.lang.String dependencyResolutionRequired
Specify the required dependencies in a specified scope
-
dependencyCollectionRequired
private java.lang.String dependencyCollectionRequired
The scope of (transitive) dependencies that should be collected but not resolved.- Since:
- 3.0-alpha-3
-
projectRequired
private boolean projectRequired
By default, the Mojo needs a Maven project to be executed
-
onlineRequired
private boolean onlineRequired
By default, the Mojo is assumed to work offline as well
-
mojoConfiguration
private org.codehaus.plexus.configuration.PlexusConfiguration mojoConfiguration
Plugin configuration
-
pluginDescriptor
private PluginDescriptor pluginDescriptor
Plugin descriptor
-
inheritedByDefault
private boolean inheritedByDefault
By default, the Mojo is inherited
-
directInvocationOnly
private boolean directInvocationOnly
By default, the Mojo cannot be invoked directly
-
requiresReports
private boolean requiresReports
By default, the Mojo don't need reports to run
-
threadSafe
private boolean threadSafe
By default, mojos are not threadsafe- Since:
- 3.0-beta-2
-
-
Method Detail
-
getLanguage
public java.lang.String getLanguage()
- Returns:
- the language of this Mojo, i.e.
java
-
setLanguage
public void setLanguage(java.lang.String language)
- Parameters:
language- the new language
-
getDeprecated
public java.lang.String getDeprecated()
- Returns:
trueif the Mojo is deprecated,falseotherwise.
-
setDeprecated
public void setDeprecated(java.lang.String deprecated)
- Parameters:
deprecated-trueto deprecate the Mojo,falseotherwise.
-
getParameters
public java.util.List<Parameter> getParameters()
- Returns:
- the list of parameters
-
setParameters
public void setParameters(java.util.List<Parameter> parameters) throws DuplicateParameterException
- Parameters:
parameters- the new list of parameters- Throws:
DuplicateParameterException- if any
-
addParameter
public void addParameter(Parameter parameter) throws DuplicateParameterException
- Parameters:
parameter- add a new parameter- Throws:
DuplicateParameterException- if any
-
getParameterMap
public java.util.Map<java.lang.String,Parameter> getParameterMap()
- Returns:
- the list parameters as a Map
-
setDependencyResolutionRequired
public void setDependencyResolutionRequired(java.lang.String requiresDependencyResolution)
- Parameters:
requiresDependencyResolution- the new required dependencies in a specified scope
-
getDependencyResolutionRequired
public java.lang.String getDependencyResolutionRequired()
-
isDependencyResolutionRequired
@Deprecated public java.lang.String isDependencyResolutionRequired()
Deprecated.- Returns:
- the required dependencies in a specified scope TODO the name is not intelligible
-
setDependencyCollectionRequired
public void setDependencyCollectionRequired(java.lang.String requiresDependencyCollection)
- Since:
- 3.0-alpha-3
-
getDependencyCollectionRequired
public java.lang.String 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
nullif none. - Since:
- 3.0-alpha-3
-
setProjectRequired
public void setProjectRequired(boolean requiresProject)
- Parameters:
requiresProject-trueif the Mojo needs a Maven project to be executed,falseotherwise.
-
isProjectRequired
public boolean isProjectRequired()
- Returns:
trueif the Mojo needs a Maven project to be executed,falseotherwise.
-
setOnlineRequired
public void setOnlineRequired(boolean requiresOnline)
- Parameters:
requiresOnline-trueif the Mojo is online,falseotherwise.
-
isOnlineRequired
public boolean isOnlineRequired()
- Returns:
trueif the Mojo is online,falseotherwise.
-
requiresOnline
public boolean requiresOnline()
- Returns:
trueif the Mojo is online,falseotherwise.
-
getPhase
public java.lang.String getPhase()
- Returns:
- the binded phase name of the Mojo
-
setPhase
public void setPhase(java.lang.String phase)
- Parameters:
phase- the new binded phase name of the Mojo
-
getSince
public java.lang.String getSince()
- Returns:
- the version when the Mojo was added to the API
-
setSince
public void setSince(java.lang.String since)
- Parameters:
since- the new version when the Mojo was added to the API
-
getGoal
public java.lang.String getGoal()
- Returns:
- The goal name of the Mojo
-
setGoal
public void setGoal(java.lang.String goal)
- Parameters:
goal- The new goal name of the Mojo
-
getExecutePhase
public java.lang.String getExecutePhase()
- Returns:
- the invocation phase of the Mojo
-
setExecutePhase
public void setExecutePhase(java.lang.String executePhase)
- Parameters:
executePhase- the new invocation phase of the Mojo
-
alwaysExecute
public boolean alwaysExecute()
- Returns:
trueif the Mojo usesalwaysfor theexecutionStrategy
-
getExecutionStrategy
public java.lang.String getExecutionStrategy()
- Returns:
- the execution strategy
-
setExecutionStrategy
public void setExecutionStrategy(java.lang.String executionStrategy)
- 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
public java.lang.String getRole()
- Overrides:
getRolein classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getRoleHint
public java.lang.String getRoleHint()
- Overrides:
getRoleHintin classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getId
public java.lang.String getId()
- Returns:
- the id of the mojo, based on the goal name
-
getFullGoalName
public java.lang.String getFullGoalName()
- Returns:
- the full goal name
- See Also:
PluginDescriptor.getGoalPrefix(),getGoal()
-
getComponentType
public java.lang.String getComponentType()
- Overrides:
getComponentTypein classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getPluginDescriptor
public PluginDescriptor getPluginDescriptor()
- Returns:
- the plugin descriptor
-
setPluginDescriptor
public void setPluginDescriptor(PluginDescriptor pluginDescriptor)
- Parameters:
pluginDescriptor- the new plugin descriptor
-
isInheritedByDefault
public boolean isInheritedByDefault()
- Returns:
trueif the Mojo is inherited,falseotherwise.
-
setInheritedByDefault
public void setInheritedByDefault(boolean inheritedByDefault)
- Parameters:
inheritedByDefault-trueif the Mojo is inherited,falseotherwise.
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
compareObjects
private boolean compareObjects(java.lang.Object first, java.lang.Object second)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classorg.codehaus.plexus.component.repository.ComponentDescriptor<Mojo>
-
getExecuteLifecycle
public java.lang.String getExecuteLifecycle()
- Returns:
- the invocation lifecycle of the Mojo
-
setExecuteLifecycle
public void setExecuteLifecycle(java.lang.String executeLifecycle)
- Parameters:
executeLifecycle- the new invocation lifecycle of the Mojo
-
setAggregator
public void setAggregator(boolean aggregator)
- Parameters:
aggregator-trueif the Mojo uses the Maven project and its child modules,falseotherwise.
-
isAggregator
public boolean isAggregator()
- Returns:
trueif the Mojo uses the Maven project and its child modules,falseotherwise.
-
isDirectInvocationOnly
public boolean isDirectInvocationOnly()
- Returns:
trueif the Mojo cannot be invoked directly,falseotherwise.
-
setDirectInvocationOnly
public void setDirectInvocationOnly(boolean directInvocationOnly)
- Parameters:
directInvocationOnly-trueif the Mojo cannot be invoked directly,falseotherwise.
-
isRequiresReports
public boolean isRequiresReports()
- Returns:
trueif the Mojo needs reports to run,falseotherwise.
-
setRequiresReports
public void setRequiresReports(boolean requiresReports)
- Parameters:
requiresReports-trueif the Mojo needs reports to run,falseotherwise.
-
setExecuteGoal
public void setExecuteGoal(java.lang.String executeGoal)
- Parameters:
executeGoal- the new invocation goal of the Mojo
-
getExecuteGoal
public java.lang.String getExecuteGoal()
- Returns:
- the invocation goal of the Mojo
-
isThreadSafe
public boolean isThreadSafe()
- Returns:
- True if the
Mojois 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:
trueif this mojo forks either a goal or the lifecycle,falseotherwise.
-
clone
public MojoDescriptor clone()
Creates a shallow copy of this mojo descriptor.- Overrides:
clonein classjava.lang.Object
-
-