On 3 Feb 2017 16:44, "Laird Nelson" <ljnel...@gmail.com> wrote:

On Fri, Feb 3, 2017 at 1:15 AM Hervé BOUTEMY <herve.bout...@free.fr> wrote:

> notice:@Component we're using in a Mojo is from Maven Plugin Tools
> org.apache.maven.plugins.annotations.Component [1]
>

Right; I (now :-)) understand this part and all of the things related to it.

The part I didn't get was that there's only one components.xml that can
possibly contain the wiring information.  There's no way, in other words,
to supply *another* components.xml that should override it.


This isn't quite right - each Maven plugin has a plugin.xml which
indirectly contributes bindings (the Maven plugin manager calls Plexus to
register bindings for mojos, etc.) - it can also have zero or more
component.xml files which are discovered by scanning the plugin realm. It
can also have a Sisu index resource file which is generated at build time
listing all JSR330 components in the plugin annotated with @Named.

All these binding sources (scoped to the plugin realm) are used to create
an injector for the plugin. This injector is also setup to look up
components from injectors visible to the plugin (such as Maven extensions)
which is where you should be able to override components.

If you have an example extension which should be overriding a component but
isn't then I'm happy to take a look.

--
Cheers, Stuart

Best,
Laird

Reply via email to