With the current Mojo descriptor extractor, it is possible to inherit Mojo annotations from parent classes, but not across projects. With this, it is e.g. not possible to subclass a "built-in" Maven mojo and inherit the annotations, or to refactor common Mojo code into a separate "Base Mojo" project, because the subclass lives in a different project. Since the annotation inheritance also only looks at parent classes, it is not possible to have annotated Mojo interfaces, e.g. for a Compiler which has different implementations.
To allow this, it should be possible to specify a list of prototypes for a Mojo. The descriptor extractor would then load the descriptors of these prototypes (from the plugin.xml) and merge them into a base descriptor for the Mojo, allowing it to inherit the annotations.
Example with MNG-2521 annotations:
For convenience, the groupId and artifactId default to the current project's values, and the goal to the current annotation's goal.
For this to work, the descriptor extractors should also create descriptors for annotated interfaces and abstract classes. These should be written into the plugin.xml and filtered out by the PluginDiscoverer, so they cannot be accessed normally.