Annotation Type MojoParameter
@Retention(RUNTIME)
@Repeatable(MojoParameters.class)
@Inherited
@Target(METHOD)
public @interface MojoParameter
Specifies a parameter value for a Mojo in a Maven plugin test.
This annotation can be used to configure individual Mojo parameters
without requiring a full POM file.
The annotation is repeatable, allowing multiple parameters to be set
on a single test method or parameter. For multiple parameters, you can
either use multiple @MojoParameter annotations or a single
MojoParameters annotation.
Example usage with a single parameter:
@Test
@InjectMojo(goal = "compile")
@MojoParameter(name = "source", value = "1.8")
void testCompilation(CompileMojo mojo) {
mojo.execute();
}
Example usage with multiple parameters:
@Test
@InjectMojo(goal = "compile")
@MojoParameter(name = "source", value = "1.8")
@MojoParameter(name = "target", value = "1.8")
@MojoParameter(name = "debug", value = "true")
void testCompilation(CompileMojo mojo) {
mojo.execute();
}
- Since:
- 3.4.0
- See Also:
-
Required Element Summary
Required Elements