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 <herve.bout...@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 <baerr...@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-unsubscr...@maven.apache.org > >>> For additional commands, e-mail: users-h...@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-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org