You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Barrie Treloar <ba...@gmail.com> on 2012/11/28 04:26:38 UTC
Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
While trying to sort out
http://maven.40175.n5.nabble.com/Retrieving-the-project-source-directories-from-MavenProject-td5733602.html
I was hacking his code and found that
Java 1.5 @Component MavenProject returns null
But when I changed it to use JavaDoc @parameter
expression="${project}" it works fine.
http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
gives an example
@Component
private MavenProject project;
http://maven.apache.org/plugin-tools/maven-plugin-annotations/apidocs/org/apache/maven/plugins/annotations/Component.html
says MavenProject can be accessed via @Component
I've not used the Java 1.5 annotations before.
Does anyone know why this might be?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Olivier Lamy <ol...@apache.org>.
2012/11/28 Barrie Treloar <ba...@gmail.com>:
>>> I've not used the Java 1.5 annotations before.
>>> Does anyone know why this might be?
>> weird as it works for all our plugins :-)
>> How do you build that ? any sample ?
>
> Got one I can take a look at?
http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/AbstractJarMojo.java
>
> Google isn't helpful because it picks up the javadoc ones too.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Barrie Treloar <ba...@gmail.com>.
>> I've not used the Java 1.5 annotations before.
>> Does anyone know why this might be?
> weird as it works for all our plugins :-)
> How do you build that ? any sample ?
Got one I can take a look at?
Google isn't helpful because it picks up the javadoc ones too.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Olivier Lamy <ol...@apache.org>.
2012/11/28 Barrie Treloar <ba...@gmail.com>:
> While trying to sort out
> http://maven.40175.n5.nabble.com/Retrieving-the-project-source-directories-from-MavenProject-td5733602.html
>
> I was hacking his code and found that
> Java 1.5 @Component MavenProject returns null
>
> But when I changed it to use JavaDoc @parameter
> expression="${project}" it works fine.
>
> http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
> gives an example
> @Component
> private MavenProject project;
>
> http://maven.apache.org/plugin-tools/maven-plugin-annotations/apidocs/org/apache/maven/plugins/annotations/Component.html
> says MavenProject can be accessed via @Component
>
> I've not used the Java 1.5 annotations before.
> Does anyone know why this might be?
weird as it works for all our plugins :-)
How do you build that ? any sample ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Hervé BOUTEMY <he...@free.fr>.
it's confusing for people mastering a lot of things
for normal people, it was really not easy to understand, and not really
documented, neither PluginParameterExpressionEvaluator (which I documented
after I uderstood) nor the '@parameter default-value="${project}"
readonly=true' pattern (lots of plugins had expression="${project}")
we had a long discussion on the dev list and found that, even if a little
magic, it would be really easier to use:
http://jira.codehaus.org/browse/MPLUGIN-204
the doc of the annotations show these special cases
Regards,
Hervé
Le mercredi 28 novembre 2012 19:00:03 Jason van Zyl a écrit :
> That's not right, and confusing. It's not a component.
>
> jvz
>
> On 2012-11-28, at 6:57 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> > magic has been done:
> > see http://maven.apache.org/plugin-tools/apidocs/src-
> > html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
> >
> > Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
> >> Internally the way @component works is to take the role of component
> >> supplied or figure it out. With that role a lookup against the container
> >> is
> >> executed. The MavenProject is not something that is available from the
> >> container because it is not a component. So I doubt it works, unless some
> >> magic was done to just make the @Component act on MavenProject's which
> >> itself doesn't make sense. It is meant to be a parameter, and that's what
> >> it has always been.
> >>
> >> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
> >>> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
> >>>> The MavenProject is not a component that is injected by the container.
> >>>> It's handled by the PluginParameterExpressionEvaluator[1] which looks
> >>>> at
> >>>> all the non-@component things and sets their values once the Mojo
> >>>> instance is constructed.
> >>>>
> >>>> [1]:
> >>>> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/o
> >>>> r
> >>>> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
> >>>
> >>> Does that mean our docs are wrong?
> >>> Do you have an example?
> >>>
> >>> I've not used annotations before and I was trying to help someone
> >>> else's user list question.
> >>> And unfortunately google returns javadoc matches as well so wading
> >>> through examples was time consuming and not very enlightening.
> >>>
> >>> And the link Olivier sent is using
> >>>
> >>> /**
> >>>
> >>> * The Maven project.
> >>> */
> >>>
> >>> @Component
> >>> private MavenProject project;
> >>>
> >>> and is working, but when I tried that it didn't.
> >>>
> >>> I'm going to try looking at the pom to see if there are some incorrect
> >>> versions of dependencies might be causing an issue.
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >> Thanks,
> >>
> >> Jason
> >>
> >> ----------------------------------------------------------
> >> Jason van Zyl
> >> Founder & CTO, Sonatype
> >> Founder, Apache Maven
> >> http://twitter.com/jvanzyl
> >> ---------------------------------------------------------
> >>
> >> To do two things at once is to do neither.
> >>
> >> -- Publilius Syrus, Roman slave, first century B.C.
> >
> > ---------------------------------------------------------------------
> > 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: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Hervé BOUTEMY <he...@free.fr>.
I wish we had this good discussion in may, when we wroked on plugin-tools ease
of use enhancements
I understand your point
And in fact, when I write that the feature was added partly because parameter
default-value="${project}" read-only="true", I see I didn't document it
either, now that I'm able to do it because it is absolutely clear in my head
(and wasn't before the work in may)
let's go ahead:
- now that the expressions will be well documented in future Maven versions
(see [1] instead of [2])
- given that I'll add a documentation on the default-value pattern to get
Maven objects, whatever we decide here
I'm ok to deprecate the @component trick in favour of the documentation
written, because the trick can be confusing
tell me if you open a Jira issue, I'll be glad to work on it
Regards,
Hervé
[1] http://maven.apache.org/ref/3.1-SNAPSHOT/maven-
core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
[2] http://maven.apache.org/ref/3.1-SNAPSHOT/maven-
core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
Le mercredi 28 novembre 2012 20:19:44 Jason van Zyl a écrit :
> How does it help by telling them something factually incorrect? A component
> has a specific definition of being an instance created by the container.
> On Nov 28, 2012, at 7:23 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> > no, we choose to do that for ease of use for the average plugin developer
> >
> > we had a long discussion on how to ease plugin development, find a better
> > name than "expression", understand that such Maven object injection case
> > is best written as default-value than expression, and so on...
> >
> > and actual plugins using @Component for injecting classical MavenProject
> > is
> > easier than @Parameter( defaultValue="${project}" ) even if the former is
> > a
> > trick
> >
> > Le mercredi 28 novembre 2012 19:05:10 Jason van Zyl a écrit :
> >> I would remove that from the doco. I assume the @Parameter method still
> >> works and just keep that method.
> >>
> >> jvz
> >>
> >> On 2012-11-28, at 6:57 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> >>> magic has been done:
> >>> see http://maven.apache.org/plugin-tools/apidocs/src-
> >>> html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
> >>>
> >>> Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
> >>>> Internally the way @component works is to take the role of component
> >>>> supplied or figure it out. With that role a lookup against the
> >>>> container
> >>>> is
> >>>> executed. The MavenProject is not something that is available from the
> >>>> container because it is not a component. So I doubt it works, unless
> >>>> some
> >>>> magic was done to just make the @Component act on MavenProject's which
> >>>> itself doesn't make sense. It is meant to be a parameter, and that's
> >>>> what
> >>>> it has always been.
> >>>>
> >>>> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
> >>>>> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
> >>>>>> The MavenProject is not a component that is injected by the
> >>>>>> container.
> >>>>>> It's handled by the PluginParameterExpressionEvaluator[1] which looks
> >>>>>> at
> >>>>>> all the non-@component things and sets their values once the Mojo
> >>>>>> instance is constructed.
> >>>>>>
> >>>>>> [1]:
> >>>>>> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java
> >>>>>> /o
> >>>>>> r
> >>>>>> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
> >>>>>
> >>>>> Does that mean our docs are wrong?
> >>>>> Do you have an example?
> >>>>>
> >>>>> I've not used annotations before and I was trying to help someone
> >>>>> else's user list question.
> >>>>> And unfortunately google returns javadoc matches as well so wading
> >>>>> through examples was time consuming and not very enlightening.
> >>>>>
> >>>>> And the link Olivier sent is using
> >>>>>
> >>>>> /**
> >>>>>
> >>>>> * The Maven project.
> >>>>> */
> >>>>>
> >>>>> @Component
> >>>>> private MavenProject project;
> >>>>>
> >>>>> and is working, but when I tried that it didn't.
> >>>>>
> >>>>> I'm going to try looking at the pom to see if there are some incorrect
> >>>>> versions of dependencies might be causing an issue.
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>>> For additional commands, e-mail: users-help@maven.apache.org
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Jason
> >>>>
> >>>> ----------------------------------------------------------
> >>>> Jason van Zyl
> >>>> Founder & CTO, Sonatype
> >>>> Founder, Apache Maven
> >>>> http://twitter.com/jvanzyl
> >>>> ---------------------------------------------------------
> >>>>
> >>>> To do two things at once is to do neither.
> >>>>
> >>>> -- Publilius Syrus, Roman slave, first century B.C.
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder & CTO, Sonatype
> Founder, Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
>
> To do two things at once is to do neither.
>
> -- Publilius Syrus, Roman slave, first century B.C.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Jason van Zyl <ja...@tesla.io>.
How does it help by telling them something factually incorrect? A component has a specific definition of being an instance created by the container.
On Nov 28, 2012, at 7:23 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> no, we choose to do that for ease of use for the average plugin developer
>
> we had a long discussion on how to ease plugin development, find a better name
> than "expression", understand that such Maven object injection case is best
> written as default-value than expression, and so on...
>
> and actual plugins using @Component for injecting classical MavenProject is
> easier than @Parameter( defaultValue="${project}" ) even if the former is a
> trick
>
> Le mercredi 28 novembre 2012 19:05:10 Jason van Zyl a écrit :
>> I would remove that from the doco. I assume the @Parameter method still
>> works and just keep that method.
>>
>> jvz
>>
>> On 2012-11-28, at 6:57 PM, Hervé BOUTEMY <he...@free.fr> wrote:
>>> magic has been done:
>>> see http://maven.apache.org/plugin-tools/apidocs/src-
>>> html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
>>>
>>> Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
>>>> Internally the way @component works is to take the role of component
>>>> supplied or figure it out. With that role a lookup against the container
>>>> is
>>>> executed. The MavenProject is not something that is available from the
>>>> container because it is not a component. So I doubt it works, unless some
>>>> magic was done to just make the @Component act on MavenProject's which
>>>> itself doesn't make sense. It is meant to be a parameter, and that's what
>>>> it has always been.
>>>>
>>>> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
>>>>> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
>>>>>> The MavenProject is not a component that is injected by the container.
>>>>>> It's handled by the PluginParameterExpressionEvaluator[1] which looks
>>>>>> at
>>>>>> all the non-@component things and sets their values once the Mojo
>>>>>> instance is constructed.
>>>>>>
>>>>>> [1]:
>>>>>> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/o
>>>>>> r
>>>>>> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
>>>>>
>>>>> Does that mean our docs are wrong?
>>>>> Do you have an example?
>>>>>
>>>>> I've not used annotations before and I was trying to help someone
>>>>> else's user list question.
>>>>> And unfortunately google returns javadoc matches as well so wading
>>>>> through examples was time consuming and not very enlightening.
>>>>>
>>>>> And the link Olivier sent is using
>>>>>
>>>>> /**
>>>>>
>>>>> * The Maven project.
>>>>> */
>>>>>
>>>>> @Component
>>>>> private MavenProject project;
>>>>>
>>>>> and is working, but when I tried that it didn't.
>>>>>
>>>>> I'm going to try looking at the pom to see if there are some incorrect
>>>>> versions of dependencies might be causing an issue.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>> Thanks,
>>>>
>>>> Jason
>>>>
>>>> ----------------------------------------------------------
>>>> Jason van Zyl
>>>> Founder & CTO, Sonatype
>>>> Founder, Apache Maven
>>>> http://twitter.com/jvanzyl
>>>> ---------------------------------------------------------
>>>>
>>>> To do two things at once is to do neither.
>>>>
>>>> -- Publilius Syrus, Roman slave, first century B.C.
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder & CTO, Sonatype
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
To do two things at once is to do neither.
-- Publilius Syrus, Roman slave, first century B.C.
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Hervé BOUTEMY <he...@free.fr>.
no, we choose to do that for ease of use for the average plugin developer
we had a long discussion on how to ease plugin development, find a better name
than "expression", understand that such Maven object injection case is best
written as default-value than expression, and so on...
and actual plugins using @Component for injecting classical MavenProject is
easier than @Parameter( defaultValue="${project}" ) even if the former is a
trick
Le mercredi 28 novembre 2012 19:05:10 Jason van Zyl a écrit :
> I would remove that from the doco. I assume the @Parameter method still
> works and just keep that method.
>
> jvz
>
> On 2012-11-28, at 6:57 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> > magic has been done:
> > see http://maven.apache.org/plugin-tools/apidocs/src-
> > html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
> >
> > Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
> >> Internally the way @component works is to take the role of component
> >> supplied or figure it out. With that role a lookup against the container
> >> is
> >> executed. The MavenProject is not something that is available from the
> >> container because it is not a component. So I doubt it works, unless some
> >> magic was done to just make the @Component act on MavenProject's which
> >> itself doesn't make sense. It is meant to be a parameter, and that's what
> >> it has always been.
> >>
> >> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
> >>> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
> >>>> The MavenProject is not a component that is injected by the container.
> >>>> It's handled by the PluginParameterExpressionEvaluator[1] which looks
> >>>> at
> >>>> all the non-@component things and sets their values once the Mojo
> >>>> instance is constructed.
> >>>>
> >>>> [1]:
> >>>> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/o
> >>>> r
> >>>> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
> >>>
> >>> Does that mean our docs are wrong?
> >>> Do you have an example?
> >>>
> >>> I've not used annotations before and I was trying to help someone
> >>> else's user list question.
> >>> And unfortunately google returns javadoc matches as well so wading
> >>> through examples was time consuming and not very enlightening.
> >>>
> >>> And the link Olivier sent is using
> >>>
> >>> /**
> >>>
> >>> * The Maven project.
> >>> */
> >>>
> >>> @Component
> >>> private MavenProject project;
> >>>
> >>> and is working, but when I tried that it didn't.
> >>>
> >>> I'm going to try looking at the pom to see if there are some incorrect
> >>> versions of dependencies might be causing an issue.
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >> Thanks,
> >>
> >> Jason
> >>
> >> ----------------------------------------------------------
> >> Jason van Zyl
> >> Founder & CTO, Sonatype
> >> Founder, Apache Maven
> >> http://twitter.com/jvanzyl
> >> ---------------------------------------------------------
> >>
> >> To do two things at once is to do neither.
> >>
> >> -- Publilius Syrus, Roman slave, first century B.C.
> >
> > ---------------------------------------------------------------------
> > 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: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Jason van Zyl <ja...@tesla.io>.
I would remove that from the doco. I assume the @Parameter method still works and just keep that method.
jvz
On 2012-11-28, at 6:57 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> magic has been done:
> see http://maven.apache.org/plugin-tools/apidocs/src-
> html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
>
> Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
>> Internally the way @component works is to take the role of component
>> supplied or figure it out. With that role a lookup against the container is
>> executed. The MavenProject is not something that is available from the
>> container because it is not a component. So I doubt it works, unless some
>> magic was done to just make the @Component act on MavenProject's which
>> itself doesn't make sense. It is meant to be a parameter, and that's what
>> it has always been.
>> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
>>> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
>>>> The MavenProject is not a component that is injected by the container.
>>>> It's handled by the PluginParameterExpressionEvaluator[1] which looks at
>>>> all the non-@component things and sets their values once the Mojo
>>>> instance is constructed.
>>>>
>>>> [1]:
>>>> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/or
>>>> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
>>> Does that mean our docs are wrong?
>>> Do you have an example?
>>>
>>> I've not used annotations before and I was trying to help someone
>>> else's user list question.
>>> And unfortunately google returns javadoc matches as well so wading
>>> through examples was time consuming and not very enlightening.
>>>
>>> And the link Olivier sent is using
>>>
>>> /**
>>>
>>> * The Maven project.
>>> */
>>>
>>> @Component
>>> private MavenProject project;
>>>
>>> and is working, but when I tried that it didn't.
>>>
>>> I'm going to try looking at the pom to see if there are some incorrect
>>> versions of dependencies might be causing an issue.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder & CTO, Sonatype
>> Founder, Apache Maven
>> http://twitter.com/jvanzyl
>> ---------------------------------------------------------
>>
>> To do two things at once is to do neither.
>>
>> -- Publilius Syrus, Roman slave, first century B.C.
>
> ---------------------------------------------------------------------
> 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: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Jason van Zyl <ja...@tesla.io>.
That's not right, and confusing. It's not a component.
jvz
On 2012-11-28, at 6:57 PM, Hervé BOUTEMY <he...@free.fr> wrote:
> magic has been done:
> see http://maven.apache.org/plugin-tools/apidocs/src-
> html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
>
> Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
>> Internally the way @component works is to take the role of component
>> supplied or figure it out. With that role a lookup against the container is
>> executed. The MavenProject is not something that is available from the
>> container because it is not a component. So I doubt it works, unless some
>> magic was done to just make the @Component act on MavenProject's which
>> itself doesn't make sense. It is meant to be a parameter, and that's what
>> it has always been.
>> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
>>> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
>>>> The MavenProject is not a component that is injected by the container.
>>>> It's handled by the PluginParameterExpressionEvaluator[1] which looks at
>>>> all the non-@component things and sets their values once the Mojo
>>>> instance is constructed.
>>>>
>>>> [1]:
>>>> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/or
>>>> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
>>> Does that mean our docs are wrong?
>>> Do you have an example?
>>>
>>> I've not used annotations before and I was trying to help someone
>>> else's user list question.
>>> And unfortunately google returns javadoc matches as well so wading
>>> through examples was time consuming and not very enlightening.
>>>
>>> And the link Olivier sent is using
>>>
>>> /**
>>>
>>> * The Maven project.
>>> */
>>>
>>> @Component
>>> private MavenProject project;
>>>
>>> and is working, but when I tried that it didn't.
>>>
>>> I'm going to try looking at the pom to see if there are some incorrect
>>> versions of dependencies might be causing an issue.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder & CTO, Sonatype
>> Founder, Apache Maven
>> http://twitter.com/jvanzyl
>> ---------------------------------------------------------
>>
>> To do two things at once is to do neither.
>>
>> -- Publilius Syrus, Roman slave, first century B.C.
>
> ---------------------------------------------------------------------
> 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: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Hervé BOUTEMY <he...@free.fr>.
magic has been done:
see http://maven.apache.org/plugin-tools/apidocs/src-
html/org/apache/maven/tools/plugin/util/PluginUtils.html#line.40
Le mercredi 28 novembre 2012 18:54:11 Jason van Zyl a écrit :
> Internally the way @component works is to take the role of component
> supplied or figure it out. With that role a lookup against the container is
> executed. The MavenProject is not something that is available from the
> container because it is not a component. So I doubt it works, unless some
> magic was done to just make the @Component act on MavenProject's which
> itself doesn't make sense. It is meant to be a parameter, and that's what
> it has always been.
> On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
> > On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
> >> The MavenProject is not a component that is injected by the container.
> >> It's handled by the PluginParameterExpressionEvaluator[1] which looks at
> >> all the non-@component things and sets their values once the Mojo
> >> instance is constructed.
> >>
> >> [1]:
> >> https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/or
> >> g/apache/maven/plugin/PluginParameterExpressionEvaluator.java>
> > Does that mean our docs are wrong?
> > Do you have an example?
> >
> > I've not used annotations before and I was trying to help someone
> > else's user list question.
> > And unfortunately google returns javadoc matches as well so wading
> > through examples was time consuming and not very enlightening.
> >
> > And the link Olivier sent is using
> >
> > /**
> >
> > * The Maven project.
> > */
> >
> > @Component
> > private MavenProject project;
> >
> > and is working, but when I tried that it didn't.
> >
> > I'm going to try looking at the pom to see if there are some incorrect
> > versions of dependencies might be causing an issue.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder & CTO, Sonatype
> Founder, Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
>
> To do two things at once is to do neither.
>
> -- Publilius Syrus, Roman slave, first century B.C.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Jason van Zyl <ja...@tesla.io>.
Internally the way @component works is to take the role of component supplied or figure it out. With that role a lookup against the container is executed. The MavenProject is not something that is available from the container because it is not a component. So I doubt it works, unless some magic was done to just make the @Component act on MavenProject's which itself doesn't make sense. It is meant to be a parameter, and that's what it has always been.
On Nov 28, 2012, at 6:03 PM, Barrie Treloar <ba...@gmail.com> wrote:
> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
>> The MavenProject is not a component that is injected by the container. It's handled by the PluginParameterExpressionEvaluator[1] which looks at all the non-@component things and sets their values once the Mojo instance is constructed.
>>
>> [1]: https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
>
> Does that mean our docs are wrong?
> Do you have an example?
>
> I've not used annotations before and I was trying to help someone
> else's user list question.
> And unfortunately google returns javadoc matches as well so wading
> through examples was time consuming and not very enlightening.
>
> And the link Olivier sent is using
> /**
> * The Maven project.
> */
> @Component
> private MavenProject project;
> and is working, but when I tried that it didn't.
>
> I'm going to try looking at the pom to see if there are some incorrect
> versions of dependencies might be causing an issue.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder & CTO, Sonatype
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
To do two things at once is to do neither.
-- Publilius Syrus, Roman slave, first century B.C.
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, Nov 29, 2012 at 10:14 AM, Olivier Lamy <ol...@apache.org> wrote:
> then don't miss
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-plugin-plugin</artifactId>
> <version>3.2</version>
> <configuration>
> <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
> </configuration>
[del]
Which is clearly documented at
http://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html
:)
As I said, I've not used it before and didn't look too closely at the
configuration to compare it with the docs - my bad.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Olivier Lamy <ol...@apache.org>.
2012/11/29 Barrie Treloar <ba...@gmail.com>:
> On Thu, Nov 29, 2012 at 9:37 AM, Olivier Lamy <ol...@apache.org> wrote:
>> see http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
>> and http://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html
>
> I tried those with his example project I forked at
> https://bitbucket.org/baerrach/randoop-maven-plugin
> (Its a mercurial repo)
>
> You can see in my comments that @Component doesn't work, but javadoc does.
>
> I can't explain why...
maybe avoid to mix doclet and annotations
then don't miss
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
<!-- if you want to generate help goal -->
<execution>
<id>help-goal</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
and add an it test to ease help :-)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, Nov 29, 2012 at 9:37 AM, Olivier Lamy <ol...@apache.org> wrote:
> see http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
> and http://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html
I tried those with his example project I forked at
https://bitbucket.org/baerrach/randoop-maven-plugin
(Its a mercurial repo)
You can see in my comments that @Component doesn't work, but javadoc does.
I can't explain why...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Olivier Lamy <ol...@apache.org>.
see http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
and http://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html
2012/11/29 Barrie Treloar <ba...@gmail.com>:
> On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
>> The MavenProject is not a component that is injected by the container. It's handled by the PluginParameterExpressionEvaluator[1] which looks at all the non-@component things and sets their values once the Mojo instance is constructed.
>>
>> [1]: https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
>
> Does that mean our docs are wrong?
> Do you have an example?
>
> I've not used annotations before and I was trying to help someone
> else's user list question.
> And unfortunately google returns javadoc matches as well so wading
> through examples was time consuming and not very enlightening.
>
> And the link Olivier sent is using
> /**
> * The Maven project.
> */
> @Component
> private MavenProject project;
> and is working, but when I tried that it didn't.
>
> I'm going to try looking at the pom to see if there are some incorrect
> versions of dependencies might be causing an issue.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc
@parameter expression="${project}" works
Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, Nov 29, 2012 at 8:49 AM, Jason van Zyl <ja...@tesla.io> wrote:
> The MavenProject is not a component that is injected by the container. It's handled by the PluginParameterExpressionEvaluator[1] which looks at all the non-@component things and sets their values once the Mojo instance is constructed.
>
> [1]: https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
Does that mean our docs are wrong?
Do you have an example?
I've not used annotations before and I was trying to help someone
else's user list question.
And unfortunately google returns javadoc matches as well so wading
through examples was time consuming and not very enlightening.
And the link Olivier sent is using
/**
* The Maven project.
*/
@Component
private MavenProject project;
and is working, but when I tried that it didn't.
I'm going to try looking at the pom to see if there are some incorrect
versions of dependencies might be causing an issue.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Mojo Java 1.5 @Component MavenProject (returns null) vs JavaDoc @parameter expression="${project}" works
Posted by Jason van Zyl <ja...@tesla.io>.
The MavenProject is not a component that is injected by the container. It's handled by the PluginParameterExpressionEvaluator[1] which looks at all the non-@component things and sets their values once the Mojo instance is constructed.
[1]: https://github.com/apache/maven-3/blob/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
On Nov 27, 2012, at 10:26 PM, Barrie Treloar <ba...@gmail.com> wrote:
> While trying to sort out
> http://maven.40175.n5.nabble.com/Retrieving-the-project-source-directories-from-MavenProject-td5733602.html
>
> I was hacking his code and found that
> Java 1.5 @Component MavenProject returns null
>
> But when I changed it to use JavaDoc @parameter
> expression="${project}" it works fine.
>
> http://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
> gives an example
> @Component
> private MavenProject project;
>
> http://maven.apache.org/plugin-tools/maven-plugin-annotations/apidocs/org/apache/maven/plugins/annotations/Component.html
> says MavenProject can be accessed via @Component
>
> I've not used the Java 1.5 annotations before.
> Does anyone know why this might be?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder & CTO, Sonatype
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