Hi Cristiano, Maven core doesn’t expose the “com.google.inject” package to plugins, which means the Injector class seen by your plugin is different to the class seen by core (this is due to classworlds isolation) which is why injecting the Injector is not currently possible. If the “com.google.inject” package was exposed from core then you would be able to inject the Injector, but there is a better way to get what you want without requiring this:
@Inject private Map<String, Arcr> arcrs; This will inject a dynamic map of all components that implement Arcr, indexed by name. The map is lazy so instances of the components are only created when you attempt to get them: Arcr selectedArcr = arcrs.get(pTracker.getNamed()); -- Cheers, Stuart On Wednesday, 6 January 2016 at 19:27, Cristiano Gavião wrote: > Hi, > > I have some components that implement the same interface. all of them > are being properly registered by sisu. > > @Named(CommonMojoConstants.OCUS_PACKAGING) > @Typed(Arcr.class) > @Singleton > public class IpArcrComponent implements Arcr > > > I'm needing to control the injection in one specific case. normally I > can use the Injector.getInstance: > > injector.getInstance(Key.get(Arcr.class, > Names.named(pTracker.getNamed()))); > > But I'm getting an error (com.google.inject.ProvisionException: Unable > to provision) when trying to inject the Injector: > > @Inject > private Injector injector; > > Its not allowed or am I missing something? > > thanks, > > Cristiano