Annotation Type MojoTest


  • @Retention(RUNTIME)
    @ExtendWith(MojoExtension.class)
    @Target(TYPE)
    public @interface MojoTest
    Annotation that enables Maven plugin (Mojo) testing support in JUnit tests. When applied to a test class, it automatically sets up the testing environment for Maven plugins, including dependency injection and parameter resolution.

    This annotation works in conjunction with InjectMojo and MojoParameter to provide a comprehensive testing framework for Maven plugins. It automatically registers the MojoExtension which handles the plugin lifecycle and dependency injection.

    Example usage:

     {@code
    Since:
    4.0.0
    See Also:
    MojoExtension, InjectMojo, MojoParameter, Provides
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean realRepositorySession
      Indicates whether to use a real repository session for the test.
    • Element Detail

      • realRepositorySession

        boolean realRepositorySession
        Indicates whether to use a real repository session for the test.
        When set to true, the test will utilize a real repository session, allowing for artifact resolution and repository interactions.
        Default:
        false