You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Ringo De Smet <ri...@gmail.com> on 2009/03/19 15:05:53 UTC
@component or @plexus.requirement?
Hello,
I'm a bit confused on the use of the @component and
@plexus.requirement Javadoc annotations.
http://docs.codehaus.org/display/MAVEN/Deterministic+Lifecycle+Planning
The above document contains the following: "injected either as a
@plexus.requirement or @component annotation, depending on whether
you're writing a Plexus component or an implementation of the Mojo
interface"
Within a complete Maven plugin implementation, where is the boundary
for the set of classes where I have to use @component annotation? Is
it only in the real plugin class (extending AbstractMojo) where I have
to use @component? Use @plexus.requirement for the rest?
Please enlighten me!
Ringo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: @component or @plexus.requirement?
Posted by Ringo De Smet <ri...@gmail.com>.
Jason,
2009/3/19 Jason van Zyl <jv...@sonatype.com>:
> One annotation is for Plexus components specifically and that is
> @plexus.requirement or @Requirement if you're doing annotations.
>
> The other is specifically for Maven plugins. The component metadata for your
> own types, like our Maven plugins, have their own component descriptors
> which are mutated on the fly inside Plexus.
OK, got it now! :-)
> But for a Maven plugin that also contains other Plexus components you need
> to use @plexus.requirement/@Requirement with your Plexus components and
> @component in your Mojo-based classes. Maven plugins may often not contain
> any Plexus components so the use of the type of annotations is completely
> partitioned. Take a look at Maven trunk if you want to see examples of the
> annotations used for Plexus components.
Does it depend what I'm trying to resolve? I have a utility class that
I wanted to give a Log object and used the @component Javadoc tag.
This worked, but Log belongs to Maven. Core question is: does
@component resolve *any* Plexus component when run within the Maven
context, or only Maven specific components?
Concerning real Java5+ annotations: I can't use them for the moment
since our build system has to remain Java 1.4 compliant.
Thanks for the answer!
Ringo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: @component or @plexus.requirement?
Posted by Jason van Zyl <jv...@sonatype.com>.
One annotation is for Plexus components specifically and that is
@plexus.requirement or @Requirement if you're doing annotations.
The other is specifically for Maven plugins. The component metadata
for your own types, like our Maven plugins, have their own component
descriptors which are mutated on the fly inside Plexus.
But for a Maven plugin that also contains other Plexus components you
need to use @plexus.requirement/@Requirement with your Plexus
components and @component in your Mojo-based classes. Maven plugins
may often not contain any Plexus components so the use of the type of
annotations is completely partitioned. Take a look at Maven trunk if
you want to see examples of the annotations used for Plexus components.
On 19-Mar-09, at 7:05 AM, Ringo De Smet wrote:
> Hello,
>
> I'm a bit confused on the use of the @component and
> @plexus.requirement Javadoc annotations.
>
> http://docs.codehaus.org/display/MAVEN/Deterministic+Lifecycle
> +Planning
>
> The above document contains the following: "injected either as a
> @plexus.requirement or @component annotation, depending on whether
> you're writing a Plexus component or an implementation of the Mojo
> interface"
>
> Within a complete Maven plugin implementation, where is the boundary
> for the set of classes where I have to use @component annotation? Is
> it only in the real plugin class (extending AbstractMojo) where I have
> to use @component? Use @plexus.requirement for the rest?
>
> Please enlighten me!
>
> Ringo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------
happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...
-- Thoreau
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org