Class MojoDescriptor

java.lang.Object
org.apache.maven.api.plugin.descriptor.MojoDescriptor
All Implemented Interfaces:
Serializable

@Experimental @Generated @ThreadSafe @Immutable public class MojoDescriptor extends Object implements Serializable
A Mojo description.
See Also:
  • Method Details

    • getGoal

      public String getGoal()
      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.
      Returns:
      a String
    • getDescription

      public String getDescription()
      The description of this Mojo's functionality.
      Returns:
      a String
    • getImplementation

      public String getImplementation()
      The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
      Returns:
      a String
    • getLanguage

      public String getLanguage()
      The implementation language for this Mojo (java, beanshell, etc.).
      Returns:
      a String
    • getPhase

      public String getPhase()
      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.

      Returns:
      a String
    • getExecutePhase

      public String getExecutePhase()
      Reference the invocation phase of the Mojo.
      Returns:
      a String
    • getExecuteGoal

      public String getExecuteGoal()
      Reference the invocation goal of the Mojo.
      Returns:
      a String
    • getExecuteLifecycle

      public String getExecuteLifecycle()
      Returns:
      a String
    • getDependencyResolution

      public String getDependencyResolution()
      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)
      Returns:
      a String
    • getDependencyCollection

      public String getDependencyCollection()
      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.
      Returns:
      a String
    • isDirectInvocationOnly

      public boolean isDirectInvocationOnly()
      Flags this Mojo to be invoked directly only.
      Returns:
      a boolean
    • isProjectRequired

      public boolean isProjectRequired()
      Flags this Mojo to require running inside of a project.
      Returns:
      a boolean
    • isOnlineRequired

      public boolean isOnlineRequired()
      Flags this Mojo to require online mode for its operation.
      Returns:
      a boolean
    • isAggregator

      public boolean isAggregator()
      Flags this Mojo to run it in a multi-module way, i.e. aggregate the build with the set of projects listed as modules.
      Returns:
      a boolean
    • isInheritedByDefault

      public boolean isInheritedByDefault()
      Specify that the Mojo is inherited.
      Returns:
      a boolean
    • getSince

      public String getSince()
      Specify the version when the Mojo was added to the API. Similar to Javadoc since.
      Returns:
      a String
    • getDeprecated

      public String getDeprecated()
      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.
      Returns:
      a String
    • getConfigurator

      public String getConfigurator()
      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.
      Returns:
      a String
    • getParameters

      @Nonnull public List<Parameter> getParameters()
      Returns:
      a List<Parameter>
    • getId

      public String getId()
      the id of the mojo, based on the goal name
      Returns:
      a String
    • getFullGoalName

      public String getFullGoalName()
      the full goal name
      Returns:
      a String
    • with

      Creates a new builder with this object as the basis.
      Returns:
      a Builder
    • withGoal

      @Nonnull public MojoDescriptor withGoal(String goal)
      Creates a new MojoDescriptor instance using the specified goal.
      Parameters:
      goal - the new String to use
      Returns:
      a MojoDescriptor with the specified goal
    • withDescription

      @Nonnull public MojoDescriptor withDescription(String description)
      Creates a new MojoDescriptor instance using the specified description.
      Parameters:
      description - the new String to use
      Returns:
      a MojoDescriptor with the specified description
    • withImplementation

      @Nonnull public MojoDescriptor withImplementation(String implementation)
      Creates a new MojoDescriptor instance using the specified implementation.
      Parameters:
      implementation - the new String to use
      Returns:
      a MojoDescriptor with the specified implementation
    • withLanguage

      @Nonnull public MojoDescriptor withLanguage(String language)
      Creates a new MojoDescriptor instance using the specified language.
      Parameters:
      language - the new String to use
      Returns:
      a MojoDescriptor with the specified language
    • withPhase

      @Nonnull public MojoDescriptor withPhase(String phase)
      Creates a new MojoDescriptor instance using the specified phase.
      Parameters:
      phase - the new String to use
      Returns:
      a MojoDescriptor with the specified phase
    • withExecutePhase

      @Nonnull public MojoDescriptor withExecutePhase(String executePhase)
      Creates a new MojoDescriptor instance using the specified executePhase.
      Parameters:
      executePhase - the new String to use
      Returns:
      a MojoDescriptor with the specified executePhase
    • withExecuteGoal

      @Nonnull public MojoDescriptor withExecuteGoal(String executeGoal)
      Creates a new MojoDescriptor instance using the specified executeGoal.
      Parameters:
      executeGoal - the new String to use
      Returns:
      a MojoDescriptor with the specified executeGoal
    • withExecuteLifecycle

      @Nonnull public MojoDescriptor withExecuteLifecycle(String executeLifecycle)
      Creates a new MojoDescriptor instance using the specified executeLifecycle.
      Parameters:
      executeLifecycle - the new String to use
      Returns:
      a MojoDescriptor with the specified executeLifecycle
    • withDependencyResolution

      @Nonnull public MojoDescriptor withDependencyResolution(String dependencyResolution)
      Creates a new MojoDescriptor instance using the specified dependencyResolution.
      Parameters:
      dependencyResolution - the new String to use
      Returns:
      a MojoDescriptor with the specified dependencyResolution
    • withDependencyCollection

      @Nonnull public MojoDescriptor withDependencyCollection(String dependencyCollection)
      Creates a new MojoDescriptor instance using the specified dependencyCollection.
      Parameters:
      dependencyCollection - the new String to use
      Returns:
      a MojoDescriptor with the specified dependencyCollection
    • withDirectInvocationOnly

      @Nonnull public MojoDescriptor withDirectInvocationOnly(boolean directInvocationOnly)
      Creates a new MojoDescriptor instance using the specified directInvocationOnly.
      Parameters:
      directInvocationOnly - the new boolean to use
      Returns:
      a MojoDescriptor with the specified directInvocationOnly
    • withProjectRequired

      @Nonnull public MojoDescriptor withProjectRequired(boolean projectRequired)
      Creates a new MojoDescriptor instance using the specified projectRequired.
      Parameters:
      projectRequired - the new boolean to use
      Returns:
      a MojoDescriptor with the specified projectRequired
    • withOnlineRequired

      @Nonnull public MojoDescriptor withOnlineRequired(boolean onlineRequired)
      Creates a new MojoDescriptor instance using the specified onlineRequired.
      Parameters:
      onlineRequired - the new boolean to use
      Returns:
      a MojoDescriptor with the specified onlineRequired
    • withAggregator

      @Nonnull public MojoDescriptor withAggregator(boolean aggregator)
      Creates a new MojoDescriptor instance using the specified aggregator.
      Parameters:
      aggregator - the new boolean to use
      Returns:
      a MojoDescriptor with the specified aggregator
    • withInheritedByDefault

      @Nonnull public MojoDescriptor withInheritedByDefault(boolean inheritedByDefault)
      Creates a new MojoDescriptor instance using the specified inheritedByDefault.
      Parameters:
      inheritedByDefault - the new boolean to use
      Returns:
      a MojoDescriptor with the specified inheritedByDefault
    • withSince

      @Nonnull public MojoDescriptor withSince(String since)
      Creates a new MojoDescriptor instance using the specified since.
      Parameters:
      since - the new String to use
      Returns:
      a MojoDescriptor with the specified since
    • withDeprecated

      @Nonnull public MojoDescriptor withDeprecated(String deprecated)
      Creates a new MojoDescriptor instance using the specified deprecated.
      Parameters:
      deprecated - the new String to use
      Returns:
      a MojoDescriptor with the specified deprecated
    • withConfigurator

      @Nonnull public MojoDescriptor withConfigurator(String configurator)
      Creates a new MojoDescriptor instance using the specified configurator.
      Parameters:
      configurator - the new String to use
      Returns:
      a MojoDescriptor with the specified configurator
    • withParameters

      @Nonnull public MojoDescriptor withParameters(Collection<Parameter> parameters)
      Creates a new MojoDescriptor instance using the specified parameters.
      Parameters:
      parameters - the new Collection<Parameter> to use
      Returns:
      a MojoDescriptor with the specified parameters
    • withId

      @Nonnull public MojoDescriptor withId(String id)
      Creates a new MojoDescriptor instance using the specified id.
      Parameters:
      id - the new String to use
      Returns:
      a MojoDescriptor with the specified id
    • withFullGoalName

      @Nonnull public MojoDescriptor withFullGoalName(String fullGoalName)
      Creates a new MojoDescriptor instance using the specified fullGoalName.
      Parameters:
      fullGoalName - the new String to use
      Returns:
      a MojoDescriptor with the specified fullGoalName
    • newInstance

      @Nonnull public static MojoDescriptor newInstance()
      Creates a new MojoDescriptor instance. Equivalent to newInstance(true).
      Returns:
      a new MojoDescriptor
      See Also:
    • newInstance

      @Nonnull public static MojoDescriptor newInstance(boolean withDefaults)
      Creates a new MojoDescriptor instance using default values or not. Equivalent to newBuilder(withDefaults).build().
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new MojoDescriptor
    • newBuilder

      @Nonnull public static MojoDescriptor.Builder newBuilder()
      Creates a new MojoDescriptor builder instance. Equivalent to newBuilder(true).
      Returns:
      a new Builder
      See Also:
    • newBuilder

      @Nonnull public static MojoDescriptor.Builder newBuilder(boolean withDefaults)
      Creates a new MojoDescriptor builder instance using default values or not.
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static MojoDescriptor.Builder newBuilder(MojoDescriptor from)
      Creates a new MojoDescriptor builder instance using the specified object as a basis. Equivalent to newBuilder(from, false).
      Parameters:
      from - the MojoDescriptor instance to use as a basis
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static MojoDescriptor.Builder newBuilder(MojoDescriptor from, boolean forceCopy)
      Creates a new MojoDescriptor builder instance using the specified object as a basis.
      Parameters:
      from - the MojoDescriptor instance to use as a basis
      forceCopy - the boolean indicating if a copy should be forced
      Returns:
      a new Builder