Annotation Interface Mojo


This annotation will mark your class as a Mojo, which is the implementation of a goal in a Maven plugin.

The mojo can be annotated with org.apache.maven.api.di.* annotations to control the lifecycle of the mojo itself, and to inject other beans.

The mojo class can also be injected with an Execute annotation to specify a forked lifecycle.

The Parameter annotation can be added on fields to inject data from the plugin configuration or from other components.

Fields can also be annotated with the Resolution annotation to be injected with the dependency collection or resolution result for the project.

Since:
4.0.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    goal name (required).
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    if the Mojo uses the Maven project and its subprojects.
    TODO: v4: add a SPI for the configurator configurator bean name.
    default phase to bind your mojo.
    boolean
    Indicates whether dependency collection will be required when executing the Mojo.
    Comma separated list of path scopes that will be required for dependency resolution.
    boolean
    does this Mojo need to be online to be executed?
    boolean
    does your mojo requires a project to be executed?
  • Element Details

    • name

      goal name (required).
      Returns:
      the goal name
    • defaultPhase

      @Nonnull String defaultPhase
      default phase to bind your mojo.
      Returns:
      the default phase
      Default:
      ""
    • projectRequired

      boolean projectRequired
      does your mojo requires a project to be executed?
      Returns:
      requires a project
      Default:
      true
    • aggregator

      boolean aggregator
      if the Mojo uses the Maven project and its subprojects.
      Returns:
      uses the Maven project and its subprojects
      Default:
      false
    • onlineRequired

      boolean onlineRequired
      does this Mojo need to be online to be executed?
      Returns:
      need to be online
      Default:
      false
    • configurator

      @Nonnull String configurator
      TODO: v4: add a SPI for the configurator configurator bean name.
      Returns:
      the configurator bean name
      Default:
      ""
    • dependencyCollection

      @Nonnull boolean dependencyCollection
      Indicates whether dependency collection will be required when executing the Mojo. If not set, it will be inferred from the fields annotated with the Resolution annotation.
      Default:
      false
    • dependencyResolutionPathScopes

      @Nonnull String dependencyResolutionPathScopes
      Comma separated list of path scopes that will be required for dependency resolution. If not set, it will be inferred from the fields annotated with the Resolution annotation.
      Default:
      ""