maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart McCulloch <mccu...@gmail.com>
Subject Re: Is there a guide on how to use Sisu within Maven plugins?
Date Fri, 03 Feb 2017 18:35:07 GMT
On 3 Feb 2017 16:44, "Laird Nelson" <ljnelson@gmail.com> wrote:

On Fri, Feb 3, 2017 at 1:15 AM Hervé BOUTEMY <herve.boutemy@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message