Howdy,

yes, Contextualizable, Startable, Stoppable, etc are all stuff from oldie
Plexus DI that is EOL. Get rid of all these.

Moreover, am really unsure you _really_ needs the container, as IMHO what
you need instead is:

@Inject
Map<String, MacroType> macroTypes;

and then just grab from that map what you need.
Remember, components injected like this are LAZY, so there is no "overhead"
of materializing them all, it all happens lazily, when you 'touch" given
component entry value.

HTH
T


On Mon, May 22, 2023 at 2:54 AM Henning Schmiedehausen <
henn...@schmiedehausen.org> wrote:

> Turns out that simply removing the method and annotating the field with
> `@Inject` and adding sisu-plexus solved that for me.
>
> -h
>
>
> On Sun, May 21, 2023 at 3:37 PM Henning Schmiedehausen <
> henn...@schmiedehausen.org> wrote:
>
> > I have a plugin where the mojo implements Contextualizable and it does
> > this:
> >
> >     @Override
> >     public void contextualize(final Context context)
> >             throws ContextException {
> >         this.container = (PlexusContainer)
> > context.get(PlexusConstants.PLEXUS_KEY);
> >     }
> >
> > Basically, this gives me access to the Plexus container at the heart of
> > maven. In turn, the code uses the container to look up specific,
> > user-loadable components:
> >
> > macroType = (MacroType) container.lookup(MacroType.ROLE, ...);
> >
> > where "MacroType.ROLE" is a specific plexus role. There are components
> > registered with the container like this:
> >
> > @Component(role = MacroType.class, hint = "demo")
> > public class DemoMacro
> >         implements MacroType {
> >
> > If I get rid of Contextualizable, how will I get access to the container?
> > Basically, I need to get my fingers on something that allows me dynamic
> > lookup of components. I am fine to rewrite this to use the sisu or guice
> > injectors, but right now, it does not work at all (the container is
> null).
> >
> > Googling/trawling the maven doc did not give any useful answers.
> >
> > -h
> >
> >
> >
> >
>

Reply via email to