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