You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Olivier Lamy <ol...@apache.org> on 2012/05/20 09:00:05 UTC

Maven Plugins annotations support @Component role attribute to Class

Hi,

After discussion on irc with Hervé, I think role attribute in
@Component can be of type Class<?> rather than String.

    @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
    protected ArtifactMetadataSource artifactMetadataSource;

Any objections on this change ?

Thanks,
-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 20.05.2012 19:46 schrieb "Hervé BOUTEMY" <he...@free.fr>:
>
> here, the end-user is a plugin developer, then someone who should be able
to
> create a (Plexus) component when necessary
>
> Yes, I liked @Component too but as soon as you write a component and
inject
> somponents inside it, you discover the discrepency: the more I work on
this,
> the more I discover these little discrepencies that lost me for a long
time.

> Notice that the target is JSR330 @Inject.
> Is it too early to use @Inject?

If @Inject supports all our use cases: go for it. It's standard, it's
available. Why wait?

Just my 2 cents.

Best regards

Ansgar

>
> Le dimanche 20 mai 2012 14:48:34 Olivier Lamy a écrit :
> > Perso, I prefer @Component more "auto documented" name.
> > IMHO The goal is to hide to end user what is used in core so why using
> > plexus naming.
> >
> > 2012/5/20 Hervé BOUTEMY <he...@free.fr>:
> > > of course, +1 since we discussed it :)
> > >
> > > but thinking once more at it, I just found that @Component should be
> > > renamed to @Requirement, to match corresponding plexus annotation,
isn't
> > > it?
> > >
> > > Regards,
> > >
> > > Hervé
> > >
> > > Le dimanche 20 mai 2012 09:00:05 Olivier Lamy a écrit :
> > >> Hi,
> > >>
> > >> After discussion on irc with Hervé, I think role attribute in
> > >> @Component can be of type Class<?> rather than String.
> > >>
> > >>     @Component( role = ArtifactMetadataSource.class, roleHint =
"maven" )
> > >>     protected ArtifactMetadataSource artifactMetadataSource;
> > >>
> > >> Any objections on this change ?
> > >>
> > >> Thanks,
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Hervé BOUTEMY <he...@free.fr>.
that was my point:

for Plexus annotations, @Component is on the component itself (I mean 
org.codehaus.plexus.component.annotations.Component [1])

but for Maven Plugin Tools, @Component is on the injection point 
(org.apache.maven.plugins.annotations.Component [2]) 


same annotation name at different level: not ideal

Regards,

Hervé


[1] http://plexus.codehaus.org/plexus-containers/plexus-component-
annotations/apidocs/org/codehaus/plexus/component/annotations/Component.html

[2] http://maven.apache.org/plugin-tools-3.0-SNAPSHOT/maven-plugin-
annotations/apidocs/org/apache/maven/plugins/annotations/Component.html

Le lundi 21 mai 2012 06:40:58 Mark Struberg a écrit :
> Hi!
> 
> Sorry that I didn't have more time yesterday night, so I missed the most
> important question:
> 
> Is the @Component annotation meant to be used on the component itself (for
> defining the factory rule, like @ApplicationScoped) or is it used on the
> InjectionPoint like @Inject?
> 
> Or is it like a @Qualifier (kind of a typesafe bean 'name') which gets used
> on both?
> 
> 
> LieGrue,
> strub
> 
> 
> 
> 
> ----- Original Message -----
> 
> > From: Brett Porter <br...@apache.org>
> > To: Maven Developers List <de...@maven.apache.org>
> > Cc:
> > Sent: Monday, May 21, 2012 7:22 AM
> > Subject: Re: Maven Plugins annotations support @Component role attribute
> > to Class<?>> 
> > On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
> >>  here, the end-user is a plugin developer, then someone who should be
> >>  able
> > 
> > to
> > 
> >>  create a (Plexus) component when necessary
> >>  
> >>  Yes, I liked @Component too but as soon as you write a component and
> >>  inject
> >>  
> >>  somponents inside it, you discover the discrepency: the more I work on
> > 
> > this,
> > 
> >>  the more I discover these little discrepencies that lost me for a long
> > 
> > time.
> > 
> >>  Notice that the target is JSR330 @Inject.
> >>  Is it too early to use @Inject?
> > 
> > Agree - I didn't think @component (the Javadoc annotation) would carry
> > over
> > to the plugin annotation. It should just use @Inject if that's feasible.
> > 
> > - Brett
> > 
> > --
> > Brett Porter
> > brett@apache.org
> > http://brettporter.wordpress.com/
> > http://au.linkedin.com/in/brettporter
> > http://twitter.com/brettporter
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Hervé BOUTEMY <he...@free.fr>.
Le lundi 21 mai 2012 20:58:08 Mark Struberg a écrit :
> > Nothing is done at maven execution time (as we will need some core
> > changes for that) and IMHO this could slow execution.
> 
> This depends on whether we do a full ClassPath scan or still have some parts
> in the XML. With e.g. CDI it would also be possible to use the existing
> plugin.xml and provide all the meta-information via the Extension SPI. That
> works fine and I know folks who have even written a CDI Extension which
> takes a Spring-XML and feeds the BeanManager with it.
> 
> But of course we need to be careful and think hard about a possible
> performance impact. LieGrue,
> strub
IIUC, that means that if Maven Plugin Tools annotations 3.0 are widely used, 
we can imagine for Maven 3.1 (or 3.2 or...) that the core gets as much info as 
possible from annotations content instead of plugin.xml, only Mojo class names 
would be in a resource file
then this would deprecate the plugin descriptor generator

that's a future in a long time, when we don't need plugins compatibility with 
even Maven 3.0: far far away!

Regards,

Hervé


> 
> 
> ----- Original Message -----
> 
> > From: Olivier Lamy <ol...@apache.org>
> > To: Maven Developers List <de...@maven.apache.org>
> > Cc:
> > Sent: Monday, May 21, 2012 5:06 PM
> > Subject: Re: Maven Plugins annotations support @Component role attribute
> > to Class<?>> 
> > 2012/5/21 Brett Porter <br...@apache.org>:
> >>  On 21/05/2012, at 9:03 PM, Olivier Lamy wrote:
> >>>  2012/5/21 Brett Porter <br...@apache.org>:
> >>>>  On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
> >>>>>  here, the end-user is a plugin developer, then someone who
> > 
> > should be able to
> > 
> >>>>>  create a (Plexus) component when necessary
> >>>>>  
> >>>>>  Yes, I liked @Component too but as soon as you write a
> > 
> > component and inject
> > 
> >>>>>  somponents inside it, you discover the discrepency: the more I
> > 
> > work on this,
> > 
> >>>>>  the more I discover these little discrepencies that lost me for
> > 
> > a long time.
> > 
> >>>>>  Notice that the target is JSR330 @Inject.
> >>>>>  Is it too early to use @Inject?
> >>>>  
> >>>>  Agree - I didn't think @component (the Javadoc annotation)
> > 
> > would carry over to the plugin annotation. It should just use @Inject if
> > that's feasible.
> > 
> >>>  Yup possible
> >>>    @Inject
> >>>    @Named( value = "maven" )
> >>>    protected ArtifactMetadataSource artifactMetadataSource;
> >>>  
> >>>  But not possible anymore for
> >>>  @Component( role = ArtifactMetadataSource.class, roleHint =
> > 
> > "maven" )
> > 
> >>>  protected Object artifactMetadataSource;
> >>>  
> >>>  but not sure it's a real problem for this "feature" :-)
> >>>  
> >>>  But again we use annotations here only for plugin metadata generation
> >>>  and not at runtime.
> >>>  
> >>>  Maybe in the future we could handle @Inject at runtime level.
> >>>  
> >>>  But IMHO classpath scanning at runtime to find various annotations
> >>>  will have a huge performance impact whereas simply reading the xml
> >>>  plugin descriptor is fast.
> >>>  And that's what we need with a tool such Maven fast
> > 
> > startup/execution.
> > 
> >>  I'm way behind on some of this stuff, but I thought the Maven side
> > 
> > scanned these at build time and constructed the component metadata - so
> > you have both available. The plugin processor would do the same...
> > Olivier?
> > 
> > Yup even with annotations everything is done in maven-plugin-plugin
> > which generate plugin descriptor.
> > Nothing is done at maven execution time (as we will need some core
> > changes for that) and IMHO this could slow execution.
> > 
> >>  - Brett
> >>  
> >>  --
> >>  Brett Porter
> >>  brett@apache.org
> >>  http://brettporter.wordpress.com/
> >>  http://au.linkedin.com/in/brettporter
> >>  http://twitter.com/brettporter
> >>  
> >>  
> >>  
> >>  
> >>  
> >>  
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >>  For additional commands, e-mail: dev-help@maven.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Mark Struberg <st...@yahoo.de>.
> Nothing is done at maven execution time (as we will need some core
> changes for that) and IMHO this could slow execution.

This depends on whether we do a full ClassPath scan or still have some parts in the XML. 
With e.g. CDI it would also be possible to use the existing plugin.xml and provide all the meta-information via the Extension SPI. That works fine and I know folks who have even written a CDI Extension which takes a Spring-XML and feeds the BeanManager with it.

But of course we need to be careful and think hard about a possible performance impact.
LieGrue,
strub


----- Original Message -----
> From: Olivier Lamy <ol...@apache.org>
> To: Maven Developers List <de...@maven.apache.org>
> Cc: 
> Sent: Monday, May 21, 2012 5:06 PM
> Subject: Re: Maven Plugins annotations support @Component role attribute to Class<?>
> 
> 2012/5/21 Brett Porter <br...@apache.org>:
>> 
>>  On 21/05/2012, at 9:03 PM, Olivier Lamy wrote:
>> 
>>>  2012/5/21 Brett Porter <br...@apache.org>:
>>>> 
>>>>  On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
>>>> 
>>>>>  here, the end-user is a plugin developer, then someone who 
> should be able to
>>>>>  create a (Plexus) component when necessary
>>>>> 
>>>>>  Yes, I liked @Component too but as soon as you write a 
> component and inject
>>>>>  somponents inside it, you discover the discrepency: the more I 
> work on this,
>>>>>  the more I discover these little discrepencies that lost me for 
> a long time.
>>>>>  Notice that the target is JSR330 @Inject.
>>>>>  Is it too early to use @Inject?
>>>> 
>>>>  Agree - I didn't think @component (the Javadoc annotation) 
> would carry over to the plugin annotation. It should just use @Inject if 
> that's feasible.
>>>  Yup possible
>>>    @Inject
>>>    @Named( value = "maven" )
>>>    protected ArtifactMetadataSource artifactMetadataSource;
>>> 
>>>  But not possible anymore for
>>>  @Component( role = ArtifactMetadataSource.class, roleHint = 
> "maven" )
>>>  protected Object artifactMetadataSource;
>>> 
>>>  but not sure it's a real problem for this "feature" :-)
>>> 
>>>  But again we use annotations here only for plugin metadata generation
>>>  and not at runtime.
>>> 
>>>  Maybe in the future we could handle @Inject at runtime level.
>>> 
>>>  But IMHO classpath scanning at runtime to find various annotations
>>>  will have a huge performance impact whereas simply reading the xml
>>>  plugin descriptor is fast.
>>>  And that's what we need with a tool such Maven fast 
> startup/execution.
>> 
>>  I'm way behind on some of this stuff, but I thought the Maven side 
> scanned these at build time and constructed the component metadata - so you have 
> both available. The plugin processor would do the same... Olivier?
> 
> Yup even with annotations everything is done in maven-plugin-plugin
> which generate plugin descriptor.
> Nothing is done at maven execution time (as we will need some core
> changes for that) and IMHO this could slow execution.
> 
>> 
>>  - Brett
>> 
>>  --
>>  Brett Porter
>>  brett@apache.org
>>  http://brettporter.wordpress.com/
>>  http://au.linkedin.com/in/brettporter
>>  http://twitter.com/brettporter
>> 
>> 
>> 
>> 
>> 
>> 
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>  For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> 
> -- 
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Olivier Lamy <ol...@apache.org>.
2012/5/21 Brett Porter <br...@apache.org>:
>
> On 21/05/2012, at 9:03 PM, Olivier Lamy wrote:
>
>> 2012/5/21 Brett Porter <br...@apache.org>:
>>>
>>> On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
>>>
>>>> here, the end-user is a plugin developer, then someone who should be able to
>>>> create a (Plexus) component when necessary
>>>>
>>>> Yes, I liked @Component too but as soon as you write a component and inject
>>>> somponents inside it, you discover the discrepency: the more I work on this,
>>>> the more I discover these little discrepencies that lost me for a long time.
>>>> Notice that the target is JSR330 @Inject.
>>>> Is it too early to use @Inject?
>>>
>>> Agree - I didn't think @component (the Javadoc annotation) would carry over to the plugin annotation. It should just use @Inject if that's feasible.
>> Yup possible
>>   @Inject
>>   @Named( value = "maven" )
>>   protected ArtifactMetadataSource artifactMetadataSource;
>>
>> But not possible anymore for
>> @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
>> protected Object artifactMetadataSource;
>>
>> but not sure it's a real problem for this "feature" :-)
>>
>> But again we use annotations here only for plugin metadata generation
>> and not at runtime.
>>
>> Maybe in the future we could handle @Inject at runtime level.
>>
>> But IMHO classpath scanning at runtime to find various annotations
>> will have a huge performance impact whereas simply reading the xml
>> plugin descriptor is fast.
>> And that's what we need with a tool such Maven fast startup/execution.
>
> I'm way behind on some of this stuff, but I thought the Maven side scanned these at build time and constructed the component metadata - so you have both available. The plugin processor would do the same... Olivier?

Yup even with annotations everything is done in maven-plugin-plugin
which generate plugin descriptor.
Nothing is done at maven execution time (as we will need some core
changes for that) and IMHO this could slow execution.

>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> http://au.linkedin.com/in/brettporter
> http://twitter.com/brettporter
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Brett Porter <br...@apache.org>.
On 21/05/2012, at 9:03 PM, Olivier Lamy wrote:

> 2012/5/21 Brett Porter <br...@apache.org>:
>> 
>> On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
>> 
>>> here, the end-user is a plugin developer, then someone who should be able to
>>> create a (Plexus) component when necessary
>>> 
>>> Yes, I liked @Component too but as soon as you write a component and inject
>>> somponents inside it, you discover the discrepency: the more I work on this,
>>> the more I discover these little discrepencies that lost me for a long time.
>>> Notice that the target is JSR330 @Inject.
>>> Is it too early to use @Inject?
>> 
>> Agree - I didn't think @component (the Javadoc annotation) would carry over to the plugin annotation. It should just use @Inject if that's feasible.
> Yup possible
>   @Inject
>   @Named( value = "maven" )
>   protected ArtifactMetadataSource artifactMetadataSource;
> 
> But not possible anymore for
> @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
> protected Object artifactMetadataSource;
> 
> but not sure it's a real problem for this "feature" :-)
> 
> But again we use annotations here only for plugin metadata generation
> and not at runtime.
> 
> Maybe in the future we could handle @Inject at runtime level.
> 
> But IMHO classpath scanning at runtime to find various annotations
> will have a huge performance impact whereas simply reading the xml
> plugin descriptor is fast.
> And that's what we need with a tool such Maven fast startup/execution.

I'm way behind on some of this stuff, but I thought the Maven side scanned these at build time and constructed the component metadata - so you have both available. The plugin processor would do the same... Olivier?

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter






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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Mark Struberg <st...@yahoo.de>.
JSR-330 knows the @Qualifier meta annotation. (@Named is a @Qualifier itself)

Thus it would be perfectly possible to create a @Role Qualifier:

@Qualifier
public @interface @Role {
  value();
  hint() default "";
}


Note: the role is usually the Interface, thus we do not need it in most cases as JSR-330/299 are typesafe anyway. Only if we inject into Object.class or a shared common interface.


and write something like:

@Inject @Role(hint="git")

private ScmProvider gitScm;


LieGrue,
strub


----- Original Message -----
> From: John Casey <jd...@commonjava.org>
> To: Maven Developers List <de...@maven.apache.org>
> Cc: 
> Sent: Monday, May 21, 2012 10:30 PM
> Subject: Re: Maven Plugins annotations support @Component role attribute to Class<?>
> 
> On 5/21/12 7:03 AM, Olivier Lamy wrote:
>>  2012/5/21 Brett Porter<br...@apache.org>:
>>> 
>>>  On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
>>> 
>>>>  here, the end-user is a plugin developer, then someone who should 
> be able to
>>>>  create a (Plexus) component when necessary
>>>> 
>>>>  Yes, I liked @Component too but as soon as you write a component 
> and inject
>>>>  somponents inside it, you discover the discrepency: the more I work 
> on this,
>>>>  the more I discover these little discrepencies that lost me for a 
> long time.
>>>>  Notice that the target is JSR330 @Inject.
>>>>  Is it too early to use @Inject?
>>> 
>>>  Agree - I didn't think @component (the Javadoc annotation) would 
> carry over to the plugin annotation. It should just use @Inject if that's 
> feasible.
>>  Yup possible
>>      @Inject
>>      @Named( value = "maven" )
>>      protected ArtifactMetadataSource artifactMetadataSource;
> 
> What do we do about:
> 
> protected Map<Wagon> wagons;
> 
> In the old setup, IIRC we used something like:
> 
> @component role=org.apache.maven.wagon.Wagon ...
> 
> If we were to use a CDI approach, we'd need a provider to compose the 
> Map instance, right? That, or we'd need to use Instance<Wagon>, unless 
> 
> I'm just too much of a newbie to know better...
> 
> In any case, what about the other collection-oriented attributes of 
> @component? Don't we have a hints= attribute, or am I confusing all of 
> this with the Plexus @Requirement stuff?
> 
>> 
>>  But not possible anymore for
>>  @Component( role = ArtifactMetadataSource.class, roleHint = 
> "maven" )
>>  protected Object artifactMetadataSource;
>> 
>>  but not sure it's a real problem for this "feature" :-)
>> 
>>  But again we use annotations here only for plugin metadata generation
>>  and not at runtime.
>> 
>>  Maybe in the future we could handle @Inject at runtime level.
>> 
>>  But IMHO classpath scanning at runtime to find various annotations
>>  will have a huge performance impact whereas simply reading the xml
>>  plugin descriptor is fast.
>>  And that's what we need with a tool such Maven fast startup/execution.
>> 
>>  my 0.02 euros
>> 
>>> 
>>>  - Brett
>>> 
>>>  --
>>>  Brett Porter
>>>  brett@apache.org
>>>  http://brettporter.wordpress.com/
>>>  http://au.linkedin.com/in/brettporter
>>>  http://twitter.com/brettporter
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>  ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>  For additional commands, e-mail: dev-help@maven.apache.org
>>> 
>> 
>> 
>> 
> 
> 
> -- 
> John Casey
> Developer, PMC Chair - Apache Maven (http://maven.apache.org)
> Blog: http://www.johnofalltrades.name/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by John Casey <jd...@commonjava.org>.
On 5/21/12 7:03 AM, Olivier Lamy wrote:
> 2012/5/21 Brett Porter<br...@apache.org>:
>>
>> On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
>>
>>> here, the end-user is a plugin developer, then someone who should be able to
>>> create a (Plexus) component when necessary
>>>
>>> Yes, I liked @Component too but as soon as you write a component and inject
>>> somponents inside it, you discover the discrepency: the more I work on this,
>>> the more I discover these little discrepencies that lost me for a long time.
>>> Notice that the target is JSR330 @Inject.
>>> Is it too early to use @Inject?
>>
>> Agree - I didn't think @component (the Javadoc annotation) would carry over to the plugin annotation. It should just use @Inject if that's feasible.
> Yup possible
>     @Inject
>     @Named( value = "maven" )
>     protected ArtifactMetadataSource artifactMetadataSource;

What do we do about:

protected Map<Wagon> wagons;

In the old setup, IIRC we used something like:

@component role=org.apache.maven.wagon.Wagon ...

If we were to use a CDI approach, we'd need a provider to compose the 
Map instance, right? That, or we'd need to use Instance<Wagon>, unless 
I'm just too much of a newbie to know better...

In any case, what about the other collection-oriented attributes of 
@component? Don't we have a hints= attribute, or am I confusing all of 
this with the Plexus @Requirement stuff?

>
> But not possible anymore for
> @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
> protected Object artifactMetadataSource;
>
> but not sure it's a real problem for this "feature" :-)
>
> But again we use annotations here only for plugin metadata generation
> and not at runtime.
>
> Maybe in the future we could handle @Inject at runtime level.
>
> But IMHO classpath scanning at runtime to find various annotations
> will have a huge performance impact whereas simply reading the xml
> plugin descriptor is fast.
> And that's what we need with a tool such Maven fast startup/execution.
>
> my 0.02 euros
>
>>
>> - Brett
>>
>> --
>> Brett Porter
>> brett@apache.org
>> http://brettporter.wordpress.com/
>> http://au.linkedin.com/in/brettporter
>> http://twitter.com/brettporter
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
>
>


-- 
John Casey
Developer, PMC Chair - Apache Maven (http://maven.apache.org)
Blog: http://www.johnofalltrades.name/

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Olivier Lamy <ol...@apache.org>.
2012/5/21 Brett Porter <br...@apache.org>:
>
> On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
>
>> here, the end-user is a plugin developer, then someone who should be able to
>> create a (Plexus) component when necessary
>>
>> Yes, I liked @Component too but as soon as you write a component and inject
>> somponents inside it, you discover the discrepency: the more I work on this,
>> the more I discover these little discrepencies that lost me for a long time.
>> Notice that the target is JSR330 @Inject.
>> Is it too early to use @Inject?
>
> Agree - I didn't think @component (the Javadoc annotation) would carry over to the plugin annotation. It should just use @Inject if that's feasible.
Yup possible
   @Inject
   @Named( value = "maven" )
   protected ArtifactMetadataSource artifactMetadataSource;

But not possible anymore for
@Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
protected Object artifactMetadataSource;

but not sure it's a real problem for this "feature" :-)

But again we use annotations here only for plugin metadata generation
and not at runtime.

Maybe in the future we could handle @Inject at runtime level.

But IMHO classpath scanning at runtime to find various annotations
will have a huge performance impact whereas simply reading the xml
plugin descriptor is fast.
And that's what we need with a tool such Maven fast startup/execution.

my 0.02 euros

>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> http://au.linkedin.com/in/brettporter
> http://twitter.com/brettporter
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

Sorry that I didn't have more time yesterday night, so I missed the most important question:

Is the @Component annotation meant to be used on the component itself (for defining the factory rule, like @ApplicationScoped) or is it used on the InjectionPoint like @Inject?

Or is it like a @Qualifier (kind of a typesafe bean 'name') which gets used on both?


LieGrue,
strub




----- Original Message -----
> From: Brett Porter <br...@apache.org>
> To: Maven Developers List <de...@maven.apache.org>
> Cc: 
> Sent: Monday, May 21, 2012 7:22 AM
> Subject: Re: Maven Plugins annotations support @Component role attribute to Class<?>
> 
> 
> On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:
> 
>>  here, the end-user is a plugin developer, then someone who should be able 
> to 
>>  create a (Plexus) component when necessary
>> 
>>  Yes, I liked @Component too but as soon as you write a component and inject 
> 
>>  somponents inside it, you discover the discrepency: the more I work on 
> this, 
>>  the more I discover these little discrepencies that lost me for a long 
> time.
>>  Notice that the target is JSR330 @Inject.
>>  Is it too early to use @Inject?
> 
> Agree - I didn't think @component (the Javadoc annotation) would carry over 
> to the plugin annotation. It should just use @Inject if that's feasible.
> 
> - Brett
> 
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> http://au.linkedin.com/in/brettporter
> http://twitter.com/brettporter
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Brett Porter <br...@apache.org>.
On 21/05/2012, at 3:45 AM, Hervé BOUTEMY wrote:

> here, the end-user is a plugin developer, then someone who should be able to 
> create a (Plexus) component when necessary
> 
> Yes, I liked @Component too but as soon as you write a component and inject 
> somponents inside it, you discover the discrepency: the more I work on this, 
> the more I discover these little discrepencies that lost me for a long time.
> Notice that the target is JSR330 @Inject.
> Is it too early to use @Inject?

Agree - I didn't think @component (the Javadoc annotation) would carry over to the plugin annotation. It should just use @Inject if that's feasible.

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter






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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Hervé BOUTEMY <he...@free.fr>.
here, the end-user is a plugin developer, then someone who should be able to 
create a (Plexus) component when necessary

Yes, I liked @Component too but as soon as you write a component and inject 
somponents inside it, you discover the discrepency: the more I work on this, 
the more I discover these little discrepencies that lost me for a long time.
Notice that the target is JSR330 @Inject.
Is it too early to use @Inject?

Le dimanche 20 mai 2012 14:48:34 Olivier Lamy a écrit :
> Perso, I prefer @Component more "auto documented" name.
> IMHO The goal is to hide to end user what is used in core so why using
> plexus naming.
> 
> 2012/5/20 Hervé BOUTEMY <he...@free.fr>:
> > of course, +1 since we discussed it :)
> > 
> > but thinking once more at it, I just found that @Component should be
> > renamed to @Requirement, to match corresponding plexus annotation, isn't
> > it?
> > 
> > Regards,
> > 
> > Hervé
> > 
> > Le dimanche 20 mai 2012 09:00:05 Olivier Lamy a écrit :
> >> Hi,
> >> 
> >> After discussion on irc with Hervé, I think role attribute in
> >> @Component can be of type Class<?> rather than String.
> >> 
> >>     @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
> >>     protected ArtifactMetadataSource artifactMetadataSource;
> >> 
> >> Any objections on this change ?
> >> 
> >> Thanks,
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Olivier Lamy <ol...@apache.org>.
Perso, I prefer @Component more "auto documented" name.
IMHO The goal is to hide to end user what is used in core so why using
plexus naming.

2012/5/20 Hervé BOUTEMY <he...@free.fr>:
> of course, +1 since we discussed it :)
>
> but thinking once more at it, I just found that @Component should be renamed
> to @Requirement, to match corresponding plexus annotation, isn't it?
>
> Regards,
>
> Hervé
>
> Le dimanche 20 mai 2012 09:00:05 Olivier Lamy a écrit :
>> Hi,
>>
>> After discussion on irc with Hervé, I think role attribute in
>> @Component can be of type Class<?> rather than String.
>>
>>     @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
>>     protected ArtifactMetadataSource artifactMetadataSource;
>>
>> Any objections on this change ?
>>
>> Thanks,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Hervé BOUTEMY <he...@free.fr>.
of course, +1 since we discussed it :)

but thinking once more at it, I just found that @Component should be renamed 
to @Requirement, to match corresponding plexus annotation, isn't it?

Regards,

Hervé

Le dimanche 20 mai 2012 09:00:05 Olivier Lamy a écrit :
> Hi,
> 
> After discussion on irc with Hervé, I think role attribute in
> @Component can be of type Class<?> rather than String.
> 
>     @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
>     protected ArtifactMetadataSource artifactMetadataSource;
> 
> Any objections on this change ?
> 
> Thanks,

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Olivier Lamy <ol...@apache.org>.
for sure you can use

@Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
protected Object artifactMetadataSource;

:-)

2012/5/20 Mirko Friedenhagen <mf...@gmail.com>:
> Hello Olivier,
>
> hopefully the role and the type of the member are  not always redundant :-):
>
> --- snip ---
> @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
> protected ArtifactMetadataSource artifactMetadataSource;
> --- snap ---
>
> Regards Mirko
>
> On Sun, May 20, 2012 at 10:56 AM, Robert Scholte
> <ap...@sourcegrounds.com> wrote:
>> +1
>>
>> Robert
>>
>> Op Sun, 20 May 2012 09:00:05 +0200 schreef Olivier Lamy <ol...@apache.org>:
>>
>>
>>> Hi,
>>>
>>> After discussion on irc with Hervé, I think role attribute in
>>> @Component can be of type Class<?> rather than String.
>>>
>>>    @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
>>>    protected ArtifactMetadataSource artifactMetadataSource;
>>>
>>> Any objections on this change ?
>>>
>>> Thanks,
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Mirko Friedenhagen <mf...@gmail.com>.
Hello Olivier,

hopefully the role and the type of the member are  not always redundant :-):

--- snip ---
@Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
protected ArtifactMetadataSource artifactMetadataSource;
--- snap ---

Regards Mirko

On Sun, May 20, 2012 at 10:56 AM, Robert Scholte
<ap...@sourcegrounds.com> wrote:
> +1
>
> Robert
>
> Op Sun, 20 May 2012 09:00:05 +0200 schreef Olivier Lamy <ol...@apache.org>:
>
>
>> Hi,
>>
>> After discussion on irc with Hervé, I think role attribute in
>> @Component can be of type Class<?> rather than String.
>>
>>    @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
>>    protected ArtifactMetadataSource artifactMetadataSource;
>>
>> Any objections on this change ?
>>
>> Thanks,
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

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


Re: Maven Plugins annotations support @Component role attribute to Class

Posted by Robert Scholte <ap...@sourcegrounds.com>.
+1

Robert

Op Sun, 20 May 2012 09:00:05 +0200 schreef Olivier Lamy <ol...@apache.org>:

> Hi,
>
> After discussion on irc with Hervé, I think role attribute in
> @Component can be of type Class<?> rather than String.
>
>     @Component( role = ArtifactMetadataSource.class, roleHint = "maven" )
>     protected ArtifactMetadataSource artifactMetadataSource;
>
> Any objections on this change ?
>
> Thanks,

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