So...sorry, I am still confused. :-( If I look at the Maven and JSR 330 guide, especially with regard to plugins ( http://maven.apache.org/maven-jsr330.html#How_to_use_JSR-330_in_plugins), then @Component is not used (see line 17 in the code sample). Are you saying this is a mistake?
I think no, you're saying both are fine, and somehow there's no difference (? maybe one is implemented in terms of the other?) but you do say "better use the Plugin Annotations", which was not the impression I got from the JSR-330 guide. Let me ask it this way: May I simply put a Java class, annotated with @Named and (say) @Singleton, in The Right Place somewhere (where is that place? what else would I have to do?), wherever that might be, and trust that some plugin asking for: @Component private Thing thing; …will somehow automagically get my implementation of Thing? (I am specifically looking to supply an implementation of http://maven.apache.org/archetype/maven-archetype-plugin/apidocs/org/apache/maven/archetype/ui/generation/ArchetypeGenerationQueryer.html. The archetype plugin "injects" an implementation of it using @Component, which I've read somewhere was somehow routing to Sisu or Guice under the covers. I was hoping that somehow since Guice and/or Sisu are really under the covers that specifying the implementation to be used at this injection point would be simple (otherwise why use injection here?). Thanks for your help so far!) Best, Laird On Wed, Feb 1, 2017 at 12:37 PM Robert Scholte <[email protected]> wrote: > @Component works for sure. We're still within the Maven Plugin Context, so > better use the Plugin Annotations. > > And yes, you can refer to both Plexus @Component instances and JSR330 > @Named instance. > > Robert > > On Wed, 01 Feb 2017 21:01:10 +0100, Laird Nelson <[email protected]> > wrote: > > > Thanks; yeah, I understand--maybe I don't actually--that there are > > certain > > Maven plugin annotations that get converted into the XML descriptor. But > > what about line 52 and following in the link you sent: > > > > > > 1. @Component( role = MyComponentExtension.class, > > 2. hint = "..." ) > > 3. private MyComponent component; > > > > > > Shouldn't that be replaced with JSR-330? Very confused; sorry! > > > > Best, > > Laird > > > > On Wed, Feb 1, 2017 at 11:59 AM Robert Scholte <[email protected]> > > wrote: > > > >> No, plugin annotation are used to generate a plugin descriptor, i.e. > >> META-INF/maven/plugin.xml > >> At runtime this file is used to initialize the plugin, whereas the > >> specified components are injected with sisu/guice > >> > >> Robert > >> > >> On Wed, 01 Feb 2017 20:52:19 +0100, Laird Nelson <[email protected]> > >> wrote: > >> > >> > Thanks. But isn't _that_, in turn, replaced by JSR-330? This is what > >> > I'm > >> > confused about. > >> > > >> > On Wed, Feb 1, 2017 at 11:26 AM Robert Scholte <[email protected]> > >> > wrote: > >> > > >> >> This is what is used nowadays: > >> >> > >> >> > >> > https://maven.apache.org/components/plugin-tools/maven-plugin-tools-annotations/index.html > >> >> > >> >> Robert > >> >> > >> >> On Wed, 01 Feb 2017 19:21:09 +0100, Laird Nelson <[email protected] > > > >> >> wrote: > >> >> > >> >> > I apologize in advance for the inarticulate nature of this > >> question. > >> >> > > >> >> > I have this faint sense that Sisu and Guice are at the core of > >> Maven > >> >> > these > >> >> > days, with a Plexus layer on top. > >> >> > > >> >> > This makes me think that perhaps I should be using different > >> >> annotations > >> >> > in > >> >> > my maven plugins than @Component etc. > >> >> > > >> >> > Is this ( > >> >> > > >> >> > >> > https://maven.apache.org/guides/plugin/guide-java-plugin-development.html) > >> >> > still the official guide for writing Maven plugins? If I wanted to > >> >> > inject > >> >> > some named Plexus component, is there some guide showing how to do > >> >> that? > >> >> > > >> >> > Thanks, > >> >> > Best, > >> >> > Laird > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [email protected] > >> >> For additional commands, e-mail: [email protected] > >> >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
