Skip to end of metadata
Go to start of metadata

Many Mojos (e.g. the compiler) execute in different phases of the build lifecycle using different "configurations". With the current JavaDoc and MNG-2521 annotations, a Mojo cannot be annotated with more than one goal. Multiple "configurations" are done by subclassing a Mojo for each "configuration", e.g. CompilerMojo and TestCompilerMojo, which are virtually identical except parameter annotations and attribute names. With MNG-2521, the proposal is to extend the annotations to allow a Mojo to be annotated with multiple goals.

For this, list annotations should be introduced for each annotation (Goal, Parameter and Component). Each member of the list should have an optional attribute specifying for which goal the annotation is. If this attribute is missing, the annotation should be valid for all goals.

Example for a CompilerMojo

Saves two classes and some typing.

When a parameter needs to have different names for different goals (e.g. "includes" and "testIncludes"), you can use setters:

On the long run, it would be nice to decouple a parameter name from the underlying attribute or method name, and allow the parameter name to be specified in the annotation.

  • No labels