You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laird Nelson <lj...@gmail.com> on 2017/02/01 18:21:09 UTC

Is there a guide on how to use Sisu within Maven plugins?

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

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
On Fri, Feb 3, 2017 at 10:22 AM Stuart McCulloch <mc...@gmail.com> wrote:

> Circling back to the original question: yes you can override components in
> recent versions of Maven but there are some caveats. First your component
> must be visible to the plugin (ie be in the same realm or a parent/imported
> realm like an extension). Second you'll need to use the priority annotation
> to raise its priority (default components get a low positive priority,
> based on their realm order - non-default components get a negative
> priority).
>

Yes!  I *knew* this had to be possible.  I will see what I can do and get
back to the list.  Thanks for your input and help.

Best,
Laird

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Stuart McCulloch <mc...@gmail.com>.
Here's a brief overview of the different layers...

Maven plugin annotations are only used at plugin build time to generate
Maven's plugin.xml - they are not used at runtime (at least the container
doesn't use them)

Maven uses this plugin.xml descriptor to setup the plugin in Plexus
(creating the class realm, registering component descriptors as well as
arranging for parameter processing - which builds on the converter API
provided by Plexus)

Plexus is now a facade on top of Sisu. This facade provides the expected
API, mapping calls to Sisu and using listeners/adapters to mimic Plexus
behaviour - such as limiting component visibility based on realm visibility.

(This was developed from scratch by observing what APIs were used by Plexus
based apps, mainly Maven, and iterating until the API surface and behaviour
matched)

Plexus bindings (be that defined in components.xml, Plexus annotations, or
registered programmatically) are canonicalized as Guice bindings to provide
interoperability with JSR330.

Sisu provides a flexible bean layer on top of Guice. It also adds extra
dynamics such as injected collections that track components provided by
different injectors (in the Maven-Plexus-Guice mapping a plugin is
represented by a single injector) as well as the ability to look up or
watch for components across multiple injectors.

Circling back to the original question: yes you can override components in
recent versions of Maven but there are some caveats. First your component
must be visible to the plugin (ie be in the same realm or a parent/imported
realm like an extension). Second you'll need to use the priority annotation
to raise its priority (default components get a low positive priority,
based on their realm order - non-default components get a negative
priority).

If someone puts together a buildable example that should work, but isn't
then I'm happy to take a look - just in case you're hitting an edge-case -
it would also help me flesh out the documentation on the wiki.

HTH

--
Cheers, Stuart

On 3 Feb 2017 11:47, "Robert Scholte" <rf...@apache.org> wrote:

> On Fri, 03 Feb 2017 12:39:56 +0100, Hervé BOUTEMY <he...@free.fr>
> wrote:
>
> Le vendredi 3 février 2017, 10:43:42 CET Robert Scholte a écrit :
>>
>>> What I expect to happen is that Plexus Component Annotations will be
>>> fully
>>> replaced with JSR330 annotations.
>>> In that case there will be only 1 @Component annotation, i.e.
>>> org.apache.maven.plugins.annotations.Component, which is fine by me.
>>>
>> We should document that
>>
>> Notice that plexus @Component is not equivalent to @Inject: Plexus
>> @Requirement is equivalent to @Inject
>>
>> And for Maven Plugin Tools, since it is used to generate plugin.xml,
>> having an
>> annotation that matches the XML fragment will help.
>>
>> The more I think at it, the more I think Maven Plugin Tools should promote
>> @Requirement (and we don't care that it is the same name as the
>> @Requirement
>> from Plexus, that means @Inject with JSR330)
>>
>> Also, I expect the community to be more familiar with the maven plugin
>>> annotations than with plexus annotations.
>>>
>> I documented how to switch from Plexus javadoc to Plexus annotations: is
>> there
>> some doc on switching from Plexus annotations to JSR330?
>>
>
> https://wiki.eclipse.org/Sisu/PlexusMigration
>
>
>> Keep in mind that the original question is actually: can I
>>> override/redefine the default implementation for a 'service'?
>>>
>> that's not this email thread: I suppose you're referring to an other
>> discussion
>>
>> Regards,
>>
>> Hervé
>>
>> The
>>> discussion about the annotations caused extra confusion but in the end
>>> had
>>> nothing to do with the issue.
>>>
>>> thanks,
>>> Robert
>>>
>>> On Fri, 03 Feb 2017 10:15:05 +0100, Hervé BOUTEMY <herve.boutemy@free.fr
>>> >
>>>
>>> wrote:
>>> > notice:@Component we're using in a Mojo is from Maven Plugin Tools
>>> > org.apache.maven.plugins.annotations.Component [1]
>>> >
>>> > it's different from @Component from Plexus, which is
>>> > org.codehaus.plexus.component.annotations.Component [2]
>>> >
>>> > Using the same class name in a different package is probably a bad
>>> idea,
>>> > because it's really confusing, sorry: perhaps we should deprecate
>>> > @Component
>>> > in Maven Plugin Tools and create an annotation with another name.
>>> > Any idea on a new name?
>>> >
>>> >
>>> > Then Maven Plugin Tools uses its annotations (@Mojo, @Execute,
>>> > @Parameter and
>>> > @Component in org.apache.maven.plugins.annotations) to generate
>>> META-INF/
>>> > maven/plugin.xml plugin descriptor [3] . @Component annotation is more
>>> > precisely at the source of
>>> >
>>> >       <requirements>
>>> >
>>> >         <requirement>
>>> >
>>> >           <role/>
>>> >           <role-hint/>
>>> >           <field-name/>
>>> >
>>> >         </requirement>
>>> >
>>> >       </requirements>
>>> >
>>> > part
>>> >
>>> > Perhaps creating a @Requirement annotation in Maven Plugin Tools to
>>> > replace
>>> > @Component would reduce confusion: it would still not make a very
>>> visible
>>> > difference between @Requirement from Maven Plugin Tools and
>>> @Requirement
>>> > from
>>> > Plexus [2]: but at least, both @Requirement annotations would have the
>>> > same
>>> > meaning
>>> >
>>> > WDYT?
>>> >
>>> > Regards,
>>> >
>>> > Hervé
>>> >
>>> >
>>> > [1] http://maven.apache.org/plugin-tools/maven-plugin-tools-
>>> annotations/
>>> > index.html#Supported_Annotations
>>> >
>>> > [2]
>>> > http://codehaus-plexus.github.io/plexus-containers/plexus-co
>>> mponent-annota
>>> > tions/
>>> >
>>> > [3] http://maven.apache.org/ref/3-LATEST/maven-plugin-api/plugin.html
>>> >
>>> > Le mercredi 1 février 2017, 20:01:10 CET Laird Nelson a écrit :
>>> >> 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 <rf...@apache.org>
>>> >>
>>> >> 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 <
>>> ljnelson@gmail.com>
>>> >> >
>>> >> > 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
>>> >>
>>> >> <rf...@apache.org>
>>> >>
>>> >> > > wrote:
>>> >> > >> This is what is used nowadays:
>>> >> https://maven.apache.org/components/plugin-tools/maven-plugi
>>> n-tools-annot
>>> >> a
>>> >>
>>> >> > tions/index.html>
>>> >> >
>>> >> > >> Robert
>>> >> > >>
>>> >> > >> On Wed, 01 Feb 2017 19:21:09 +0100, Laird Nelson
>>> >>
>>> >> <lj...@gmail.com>
>>> >>
>>> >> > >> 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: users-unsubscribe@maven.apache.org
>>> >> > >> For additional commands, e-mail: users-help@maven.apache.org
>>> >> >
>>> >> > ------------------------------------------------------------
>>> ---------
>>> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> >> > For additional commands, e-mail: users-help@maven.apache.org
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> > For additional commands, e-mail: users-help@maven.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
On Fri, 03 Feb 2017 12:39:56 +0100, Hervé BOUTEMY <he...@free.fr>  
wrote:

> Le vendredi 3 février 2017, 10:43:42 CET Robert Scholte a écrit :
>> What I expect to happen is that Plexus Component Annotations will be  
>> fully
>> replaced with JSR330 annotations.
>> In that case there will be only 1 @Component annotation, i.e.
>> org.apache.maven.plugins.annotations.Component, which is fine by me.
> We should document that
>
> Notice that plexus @Component is not equivalent to @Inject: Plexus
> @Requirement is equivalent to @Inject
>
> And for Maven Plugin Tools, since it is used to generate plugin.xml,  
> having an
> annotation that matches the XML fragment will help.
>
> The more I think at it, the more I think Maven Plugin Tools should  
> promote
> @Requirement (and we don't care that it is the same name as the  
> @Requirement
> from Plexus, that means @Inject with JSR330)
>
>> Also, I expect the community to be more familiar with the maven plugin
>> annotations than with plexus annotations.
> I documented how to switch from Plexus javadoc to Plexus annotations: is  
> there
> some doc on switching from Plexus annotations to JSR330?

https://wiki.eclipse.org/Sisu/PlexusMigration

>
>> Keep in mind that the original question is actually: can I
>> override/redefine the default implementation for a 'service'?
> that's not this email thread: I suppose you're referring to an other
> discussion
>
> Regards,
>
> Hervé
>
>> The
>> discussion about the annotations caused extra confusion but in the end  
>> had
>> nothing to do with the issue.
>>
>> thanks,
>> Robert
>>
>> On Fri, 03 Feb 2017 10:15:05 +0100, Hervé BOUTEMY  
>> <he...@free.fr>
>>
>> wrote:
>> > notice:@Component we're using in a Mojo is from Maven Plugin Tools
>> > org.apache.maven.plugins.annotations.Component [1]
>> >
>> > it's different from @Component from Plexus, which is
>> > org.codehaus.plexus.component.annotations.Component [2]
>> >
>> > Using the same class name in a different package is probably a bad  
>> idea,
>> > because it's really confusing, sorry: perhaps we should deprecate
>> > @Component
>> > in Maven Plugin Tools and create an annotation with another name.
>> > Any idea on a new name?
>> >
>> >
>> > Then Maven Plugin Tools uses its annotations (@Mojo, @Execute,
>> > @Parameter and
>> > @Component in org.apache.maven.plugins.annotations) to generate  
>> META-INF/
>> > maven/plugin.xml plugin descriptor [3] . @Component annotation is more
>> > precisely at the source of
>> >
>> >       <requirements>
>> >
>> >         <requirement>
>> >
>> >           <role/>
>> >           <role-hint/>
>> >           <field-name/>
>> >
>> >         </requirement>
>> >
>> >       </requirements>
>> >
>> > part
>> >
>> > Perhaps creating a @Requirement annotation in Maven Plugin Tools to
>> > replace
>> > @Component would reduce confusion: it would still not make a very  
>> visible
>> > difference between @Requirement from Maven Plugin Tools and  
>> @Requirement
>> > from
>> > Plexus [2]: but at least, both @Requirement annotations would have the
>> > same
>> > meaning
>> >
>> > WDYT?
>> >
>> > Regards,
>> >
>> > Hervé
>> >
>> >
>> > [1]  
>> http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/
>> > index.html#Supported_Annotations
>> >
>> > [2]
>> >  
>> http://codehaus-plexus.github.io/plexus-containers/plexus-component-annota
>> > tions/
>> >
>> > [3] http://maven.apache.org/ref/3-LATEST/maven-plugin-api/plugin.html
>> >
>> > Le mercredi 1 février 2017, 20:01:10 CET Laird Nelson a écrit :
>> >> 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 <rf...@apache.org>
>> >>
>> >> 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  
>> <lj...@gmail.com>
>> >> >
>> >> > 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
>> >>
>> >> <rf...@apache.org>
>> >>
>> >> > > wrote:
>> >> > >> This is what is used nowadays:
>> >>  
>> https://maven.apache.org/components/plugin-tools/maven-plugin-tools-annot
>> >> a
>> >>
>> >> > tions/index.html>
>> >> >
>> >> > >> Robert
>> >> > >>
>> >> > >> On Wed, 01 Feb 2017 19:21:09 +0100, Laird Nelson
>> >>
>> >> <lj...@gmail.com>
>> >>
>> >> > >> 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: users-unsubscribe@maven.apache.org
>> >> > >> For additional commands, e-mail: users-help@maven.apache.org
>> >> >
>> >> >  
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Hervé BOUTEMY <he...@free.fr>.
Le vendredi 3 février 2017, 10:43:42 CET Robert Scholte a écrit :
> What I expect to happen is that Plexus Component Annotations will be fully
> replaced with JSR330 annotations.
> In that case there will be only 1 @Component annotation, i.e.
> org.apache.maven.plugins.annotations.Component, which is fine by me.
We should document that

Notice that plexus @Component is not equivalent to @Inject: Plexus 
@Requirement is equivalent to @Inject

And for Maven Plugin Tools, since it is used to generate plugin.xml, having an 
annotation that matches the XML fragment will help.

The more I think at it, the more I think Maven Plugin Tools should promote 
@Requirement (and we don't care that it is the same name as the @Requirement 
from Plexus, that means @Inject with JSR330)

> Also, I expect the community to be more familiar with the maven plugin
> annotations than with plexus annotations.
I documented how to switch from Plexus javadoc to Plexus annotations: is there 
some doc on switching from Plexus annotations to JSR330?

> Keep in mind that the original question is actually: can I
> override/redefine the default implementation for a 'service'?
that's not this email thread: I suppose you're referring to an other 
discussion

Regards,

Hervé

> The
> discussion about the annotations caused extra confusion but in the end had
> nothing to do with the issue.
> 
> thanks,
> Robert
> 
> On Fri, 03 Feb 2017 10:15:05 +0100, Hervé BOUTEMY <he...@free.fr>
> 
> wrote:
> > notice:@Component we're using in a Mojo is from Maven Plugin Tools
> > org.apache.maven.plugins.annotations.Component [1]
> > 
> > it's different from @Component from Plexus, which is
> > org.codehaus.plexus.component.annotations.Component [2]
> > 
> > Using the same class name in a different package is probably a bad idea,
> > because it's really confusing, sorry: perhaps we should deprecate
> > @Component
> > in Maven Plugin Tools and create an annotation with another name.
> > Any idea on a new name?
> > 
> > 
> > Then Maven Plugin Tools uses its annotations (@Mojo, @Execute,
> > @Parameter and
> > @Component in org.apache.maven.plugins.annotations) to generate META-INF/
> > maven/plugin.xml plugin descriptor [3] . @Component annotation is more
> > precisely at the source of
> > 
> >       <requirements>
> >       
> >         <requirement>
> >         
> >           <role/>
> >           <role-hint/>
> >           <field-name/>
> >         
> >         </requirement>
> >       
> >       </requirements>
> > 
> > part
> > 
> > Perhaps creating a @Requirement annotation in Maven Plugin Tools to
> > replace
> > @Component would reduce confusion: it would still not make a very visible
> > difference between @Requirement from Maven Plugin Tools and @Requirement
> > from
> > Plexus [2]: but at least, both @Requirement annotations would have the
> > same
> > meaning
> > 
> > WDYT?
> > 
> > Regards,
> > 
> > Hervé
> > 
> > 
> > [1] http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/
> > index.html#Supported_Annotations
> > 
> > [2]
> > http://codehaus-plexus.github.io/plexus-containers/plexus-component-annota
> > tions/
> > 
> > [3] http://maven.apache.org/ref/3-LATEST/maven-plugin-api/plugin.html
> > 
> > Le mercredi 1 février 2017, 20:01:10 CET Laird Nelson a écrit :
> >> 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 <rf...@apache.org>
> >> 
> >> 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 <lj...@gmail.com>
> >> > 
> >> > 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
> >> 
> >> <rf...@apache.org>
> >> 
> >> > > wrote:
> >> > >> This is what is used nowadays:
> >> https://maven.apache.org/components/plugin-tools/maven-plugin-tools-annot
> >> a
> >> 
> >> > tions/index.html>
> >> > 
> >> > >> Robert
> >> > >> 
> >> > >> On Wed, 01 Feb 2017 19:21:09 +0100, Laird Nelson
> >> 
> >> <lj...@gmail.com>
> >> 
> >> > >> 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: users-unsubscribe@maven.apache.org
> >> > >> For additional commands, e-mail: users-help@maven.apache.org
> >> > 
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
What I expect to happen is that Plexus Component Annotations will be fully  
replaced with JSR330 annotations.
In that case there will be only 1 @Component annotation, i.e.  
org.apache.maven.plugins.annotations.Component, which is fine by me.
Also, I expect the community to be more familiar with the maven plugin  
annotations than with plexus annotations.
Keep in mind that the original question is actually: can I  
override/redefine the default implementation for a 'service'? The  
discussion about the annotations caused extra confusion but in the end had  
nothing to do with the issue.

thanks,
Robert

On Fri, 03 Feb 2017 10:15:05 +0100, Hervé BOUTEMY <he...@free.fr>  
wrote:

> notice:@Component we're using in a Mojo is from Maven Plugin Tools
> org.apache.maven.plugins.annotations.Component [1]
>
> it's different from @Component from Plexus, which is
> org.codehaus.plexus.component.annotations.Component [2]
>
> Using the same class name in a different package is probably a bad idea,
> because it's really confusing, sorry: perhaps we should deprecate  
> @Component
> in Maven Plugin Tools and create an annotation with another name.
> Any idea on a new name?
>
>
> Then Maven Plugin Tools uses its annotations (@Mojo, @Execute,  
> @Parameter and
> @Component in org.apache.maven.plugins.annotations) to generate META-INF/
> maven/plugin.xml plugin descriptor [3] . @Component annotation is more
> precisely at the source of
>       <requirements>
>         <requirement>
>           <role/>
>           <role-hint/>
>           <field-name/>
>         </requirement>
>       </requirements>
> part
>
> Perhaps creating a @Requirement annotation in Maven Plugin Tools to  
> replace
> @Component would reduce confusion: it would still not make a very visible
> difference between @Requirement from Maven Plugin Tools and @Requirement  
> from
> Plexus [2]: but at least, both @Requirement annotations would have the  
> same
> meaning
>
> WDYT?
>
> Regards,
>
> Hervé
>
>
> [1] http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/
> index.html#Supported_Annotations
>
> [2]  
> http://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/
>
> [3] http://maven.apache.org/ref/3-LATEST/maven-plugin-api/plugin.html
>
> Le mercredi 1 février 2017, 20:01:10 CET Laird Nelson a écrit :
>> 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 <rf...@apache.org>  
>> 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 <lj...@gmail.com>
>> >
>> > 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  
>> <rf...@apache.org>
>> > >
>> > > wrote:
>> > >> This is what is used nowadays:
>> >  
>> https://maven.apache.org/components/plugin-tools/maven-plugin-tools-annota
>> > tions/index.html>
>> > >> Robert
>> > >>
>> > >> On Wed, 01 Feb 2017 19:21:09 +0100, Laird Nelson  
>> <lj...@gmail.com>
>> > >>
>> > >> 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: users-unsubscribe@maven.apache.org
>> > >> For additional commands, e-mail: users-help@maven.apache.org
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Stuart McCulloch <mc...@gmail.com>.
On 3 Feb 2017 16:44, "Laird Nelson" <lj...@gmail.com> wrote:

On Fri, Feb 3, 2017 at 1:15 AM Hervé BOUTEMY <he...@free.fr> wrote:

> notice:@Component we're using in a Mojo is from Maven Plugin Tools
> org.apache.maven.plugins.annotations.Component [1]
>

Right; I (now :-)) understand this part and all of the things related to it.

The part I didn't get was that there's only one components.xml that can
possibly contain the wiring information.  There's no way, in other words,
to supply *another* components.xml that should override it.


This isn't quite right - each Maven plugin has a plugin.xml which
indirectly contributes bindings (the Maven plugin manager calls Plexus to
register bindings for mojos, etc.) - it can also have zero or more
component.xml files which are discovered by scanning the plugin realm. It
can also have a Sisu index resource file which is generated at build time
listing all JSR330 components in the plugin annotated with @Named.

All these binding sources (scoped to the plugin realm) are used to create
an injector for the plugin. This injector is also setup to look up
components from injectors visible to the plugin (such as Maven extensions)
which is where you should be able to override components.

If you have an example extension which should be overriding a component but
isn't then I'm happy to take a look.

--
Cheers, Stuart

Best,
Laird

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
On Fri, Feb 3, 2017 at 1:15 AM Hervé BOUTEMY <he...@free.fr> wrote:

> notice:@Component we're using in a Mojo is from Maven Plugin Tools
> org.apache.maven.plugins.annotations.Component [1]
>

Right; I (now :-)) understand this part and all of the things related to it.

The part I didn't get was that there's only one components.xml that can
possibly contain the wiring information.  There's no way, in other words,
to supply *another* components.xml that should override it.

Best,
Laird

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Hervé BOUTEMY <he...@free.fr>.
notice:@Component we're using in a Mojo is from Maven Plugin Tools 
org.apache.maven.plugins.annotations.Component [1]

it's different from @Component from Plexus, which is 
org.codehaus.plexus.component.annotations.Component [2]

Using the same class name in a different package is probably a bad idea, 
because it's really confusing, sorry: perhaps we should deprecate @Component 
in Maven Plugin Tools and create an annotation with another name.
Any idea on a new name?


Then Maven Plugin Tools uses its annotations (@Mojo, @Execute, @Parameter and 
@Component in org.apache.maven.plugins.annotations) to generate META-INF/
maven/plugin.xml plugin descriptor [3] . @Component annotation is more 
precisely at the source of
      <requirements>
        <requirement>
          <role/>
          <role-hint/>
          <field-name/>
        </requirement>
      </requirements>
part

Perhaps creating a @Requirement annotation in Maven Plugin Tools to replace 
@Component would reduce confusion: it would still not make a very visible 
difference between @Requirement from Maven Plugin Tools and @Requirement from 
Plexus [2]: but at least, both @Requirement annotations would have the same 
meaning

WDYT?

Regards,

Hervé


[1] http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/
index.html#Supported_Annotations

[2] http://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/

[3] http://maven.apache.org/ref/3-LATEST/maven-plugin-api/plugin.html

Le mercredi 1 février 2017, 20:01:10 CET Laird Nelson a écrit :
> 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 <rf...@apache.org> 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 <lj...@gmail.com>
> > 
> > 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 <rf...@apache.org>
> > > 
> > > wrote:
> > >> This is what is used nowadays:
> > https://maven.apache.org/components/plugin-tools/maven-plugin-tools-annota
> > tions/index.html> 
> > >> Robert
> > >> 
> > >> On Wed, 01 Feb 2017 19:21:09 +0100, Laird Nelson <lj...@gmail.com>
> > >> 
> > >> 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: users-unsubscribe@maven.apache.org
> > >> For additional commands, e-mail: users-help@maven.apache.org
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
On Thu, Feb 2, 2017 at 1:51 AM Robert Scholte <rf...@apache.org> wrote:

> So basically it is still the same issue as a week or so ago: how to select
> a different implementation for an interface.
> Doing this within your code:
> AFAIK that's not possible, and I wonder if even JSR330 supports it.
>

Thanks.  The additional information I had this time was a better
understanding of how Plexus, Sisu and Guice were all tied together.  I
thought that perhaps like CDI or HK2 I could specify somewhere else which
implementation I wanted selected when no hint was provided, but perhaps
Guice doesn't work like that (I don't know it), and Sisu…my understanding
is that's a shim that does a form of autowiring for Guice.


> If you don't specify a specific hint (or name), the default implementation
> will be used.
>

OK, thanks!  Isn't that just the same as…just using the default
implementation, without having to go through the injection mechanism?  I
guess injection in this case is buying you configuration.

Best,
Laird

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
So basically it is still the same issue as a week or so ago: how to select  
a different implementation for an interface.
Doing this within your code:
AFAIK that's not possible, and I wonder if even JSR330 supports it.

If you don't specify a specific hint (or name), the default implementation  
will be used.
If you want a specific implementation, you need to specify it.

With Plexus this is possible:

@Requirement
private Map<String,SomeService> serviceMap;

this will give you all the available SomeServices, where the key maps to  
the hint.
Now you can easily pick the preferred instance.

Back to why you want this: You want another ArchetypeGenerationQueryer.  
This means that on the places where this is injected, you don't want the  
default instance, but instead a  Map, so you can select one. A pull  
request for the Maven Archetype project is required here.

This is the most clean solution.

There might be different solution, but that means you need to get access  
to the Guice context and re-bind the service to a new implementation. I  
wonder if that'll work.

Robert

On Wed, 01 Feb 2017 23:32:29 +0100, Laird Nelson <lj...@gmail.com>  
wrote:

> On Wed, Feb 1, 2017 at 1:27 PM Robert Scholte <rf...@apache.org>  
> wrote:
>
>> bq. If you want to use JSR-330, you must understand that your code won't
>> be compatible with Maven 2 or 3.0.x but only with Maven 3.1.0+
>>
>> this is probably the reason why *I* haven't seen it used that much.
>>
>
> Sure.  In my case, this won't matter.
>
>
>> Your confusion is probably coming from 2 different descriptors, which  
>> both
>> use @Component.
>>
>
> No, I'm aware of both of them.  I'm interested indirectly in the Maven
> plugin API @Component, which indirectly causes a <component>  
> element/stanza
> in the plugin.xml.  I know that part.  What I *don't* know (still!) is  
> how,
> as an end user, to alter the *components.xml* that is *already present*  
> in
> the maven-archetype-plugin (the plugin whose component selection I want  
> to
> override) such that *my* implementation is chosen instead of the default
> one.  I was hoping to use Sisu/Guice/something else to accomplish this
> since there doesn't seem to be any documented way to do it using Plexus
> constructs.
>
> Thanks again for your help.
>
> Best,
> Laird

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
On Wed, Feb 1, 2017 at 1:27 PM Robert Scholte <rf...@apache.org> wrote:

> bq. If you want to use JSR-330, you must understand that your code won't
> be compatible with Maven 2 or 3.0.x but only with Maven 3.1.0+
>
> this is probably the reason why *I* haven't seen it used that much.
>

Sure.  In my case, this won't matter.


> Your confusion is probably coming from 2 different descriptors, which both
> use @Component.
>

No, I'm aware of both of them.  I'm interested indirectly in the Maven
plugin API @Component, which indirectly causes a <component> element/stanza
in the plugin.xml.  I know that part.  What I *don't* know (still!) is how,
as an end user, to alter the *components.xml* that is *already present* in
the maven-archetype-plugin (the plugin whose component selection I want to
override) such that *my* implementation is chosen instead of the default
one.  I was hoping to use Sisu/Guice/something else to accomplish this
since there doesn't seem to be any documented way to do it using Plexus
constructs.

Thanks again for your help.

Best,
Laird

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
bq. If you want to use JSR-330, you must understand that your code won't  
be compatible with Maven 2 or 3.0.x but only with Maven 3.1.0+

this is probably the reason why *I* haven't seen it used that much.

Your confusion is probably coming from 2 different descriptors, which both  
use @Component.
Up until now I talked about the maven plugin descriptor.

There's also a plexus component descriptor with matching annotations[1],  
which are (completely?) replaceable with the JSR330 Annotations.
In case of Plexus we generate a component descriptor with the  
plexus-component-metadata maven-plugin[2]

The maven plugin API @Component is equivalent to @Inject
The plexus component API @Component is equivalent to @Named/@Singeton
The plexus component API @Requirement is equivalent to @Inject

Robert

[1] https://github.com/sonatype/plexus-containers
[2]  
https://codehaus-plexus.github.io/plexus-containers/plexus-component-metadata/plugin-info.html

On Wed, 01 Feb 2017 21:53:49 +0100, Laird Nelson <lj...@gmail.com>  
wrote:

> 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 <rf...@apache.org>  
> 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 <lj...@gmail.com>
>> 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 <rf...@apache.org>
>> > 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 <lj...@gmail.com>
>> >> 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  
>> <rf...@apache.org>
>> >> > 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  
>> <ljnelson@gmail.com
>> >
>> >> >> 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: users-unsubscribe@maven.apache.org
>> >> >> For additional commands, e-mail: users-help@maven.apache.org
>> >> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
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 <rf...@apache.org> 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 <lj...@gmail.com>
> 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 <rf...@apache.org>
> > 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 <lj...@gmail.com>
> >> 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 <rf...@apache.org>
> >> > 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 <ljnelson@gmail.com
> >
> >> >> 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: users-unsubscribe@maven.apache.org
> >> >> For additional commands, e-mail: users-help@maven.apache.org
> >> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
@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 <lj...@gmail.com>  
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 <rf...@apache.org>  
> 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 <lj...@gmail.com>
>> 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 <rf...@apache.org>
>> > 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 <lj...@gmail.com>
>> >> 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: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
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 <rf...@apache.org> 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 <lj...@gmail.com>
> 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 <rf...@apache.org>
> > 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 <lj...@gmail.com>
> >> 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: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
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 <lj...@gmail.com>  
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 <rf...@apache.org>  
> 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 <lj...@gmail.com>
>> 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: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Laird Nelson <lj...@gmail.com>.
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 <rf...@apache.org> 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 <lj...@gmail.com>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Robert Scholte <rf...@apache.org>.
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 <lj...@gmail.com>  
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Is there a guide on how to use Sisu within Maven plugins?

Posted by Dan Tran <da...@gmail.com>.
JSR330 is supported [1]

JSR250 not yet [2]

-D

http://maven.apache.org/maven-jsr330.html

https://issues.apache.org/jira/browse/MNG-6084  cast your note

On Wed, Feb 1, 2017 at 10:21 AM, Laird Nelson <lj...@gmail.com> 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
>