On 19 Feb 2013, at 17:39, Karl Heinz Marbaise wrote: > Hi, > > currently I'm working on a plugin which works so far so good...but now i > stumbled over a problem which i didn't understand... > > I have a dependency to maven-invoker artifact: > > <dependency> > <groupId>org.apache.maven.shared</groupId> > <artifactId>maven-invoker</artifactId> > <version>2.1.1</version> > </dependency> > > I have the following annotations in my plugin mojo (using java 5 annotations): > > @Component > private Invoker invoker; > > @Component > private InvocationRequest request;
^ looking at the invoker source (Default)InvocationRequest is not a component but is instead created per-request in AbstractInvokerMojo using 'new' and passed into the invoker: http://svn.apache.org/viewvc/maven/plugins/tags/maven-invoker-plugin-1.8/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java?view=markup#l1593 The Invoker is a component, so that can be injected - it's just the InvocationRequest that has to be assembled based on the supplied parameters rather than injected. > So I thought the injection container will do it's work, but it failed. > > Ok..may be I had to be more accurate like the following: > > @Component(role=org.apache.maven.shared.invoker.Invoker.class, hint="default") > private Invoker invoker; > @Component(role=org.apache.maven.shared.invoker.InvocationRequest.class, > hint="default") > private InvocationRequest request; > > But this doesn't helped either... > > I allways got the following error message: > > [DEBUG] Configuring mojo > com.soebes.maven.plugins:itexin-maven-plugin:0.1.0-SNAPSHOT:invoker from > plugin realm > ClassRealm[plugin>com.soebes.maven.plugins:itexin-maven-plugin:0.1.0-SNAPSHOT, > parent: sun.misc.Launcher$AppClassLoader@3182f0db] > Feb 19, 2013 4:48:54 PM org.sonatype.guice.bean.reflect.Logs$JULSink warn > WARNING: Error injecting: com.soebes.maven.plugins.itexin.InvokerMojo > com.google.inject.ProvisionException: Guice provision errors: > > 1) No implementation for org.apache.maven.shared.invoker.InvocationRequest > was bound. > while locating com.soebes.maven.plugins.itexin.InvokerMojo > > 1 error > at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974) > at > com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000) > at > org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45) > at > com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.j > > > It looks like i misunderstand a thing here....but currently I'm blockhead ;-( > > Can someone enlighten me a little bit and may be give me hint what I'm doing > wrong ... > > The project can be found here: > https://github.com/khmarbaise/itexin-maven-plugin/tree/invoker-first > > Many thanks in advance.. > Kind regards > Karl-Heinz Marbaise > -- > SoftwareEntwicklung Beratung Schulung Tel.: +49 (0) 2405 / 415 893 > Dipl.Ing.(FH) Karl-Heinz Marbaise ICQ#: 135949029 > Hauptstrasse 177 USt.IdNr: DE191347579 > 52146 Würselen http://www.soebes.de > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > For additional commands, e-mail: dev-h...@maven.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org