You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Simone Tripodi <si...@apache.org> on 2014/06/23 14:33:15 UTC

Inject Maven components/parameters to Plexus components

Hi all mates,

I am a little lost and I would like to kindly ask you if anyone knows
how to request, via Plexus annotations, the injection of Maven
parameters/components.

While for components I guess it is more or less the same as in MOJOs,
just using different kind annotations, it is not clear to me if it is
possible, and how, to request a MOJO parameter injection inside a
Plexus component, i.e. the ${project.groupId} or
${project.remotePluginRepositories}

Many thanks in advance, all the best!
-Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi

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


Re: Inject Maven components/parameters to Plexus components

Posted by Simone Tripodi <si...@apache.org>.
Thanks a lot for the clarification Jason, much more than appreciated!

All the best!
-Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi


On Mon, Jun 23, 2014 at 3:00 PM, Jason van Zyl <ja...@takari.io> wrote:
> The short answer is that you can't right now. We do not create bindings in the normal JSR330 for configuration injection, we historically use a tool called the PluginParameterExpressionEvaluator to pass over the component once it's instantiated. We did this long before we used any container. As part of the JSR330 work I'm doing I would like to dynamically create bindings so that plugins can be simple POJOs using private/final constructor injection where the bindings get created from the same process we use now except expose this to the container during object instantiation.
>
> Until that happens you can always make a singleton component and pass in your configuration as parameters. If you need to manage state then you'll have to do that yourself with a context of some sort.
>
> On Jun 23, 2014, at 8:33 AM, Simone Tripodi <si...@apache.org> wrote:
>
>> Hi all mates,
>>
>> I am a little lost and I would like to kindly ask you if anyone knows
>> how to request, via Plexus annotations, the injection of Maven
>> parameters/components.
>>
>> While for components I guess it is more or less the same as in MOJOs,
>> just using different kind annotations, it is not clear to me if it is
>> possible, and how, to request a MOJO parameter injection inside a
>> Plexus component, i.e. the ${project.groupId} or
>> ${project.remotePluginRepositories}
>>
>> Many thanks in advance, all the best!
>> -Simo
>>
>> http://people.apache.org/~simonetripodi/
>> http://twitter.com/simonetripodi
>>
>> ---------------------------------------------------------------------
>> 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
> http://twitter.com/takari_io
> ---------------------------------------------------------
>
> First, the taking in of scattered particulars under one Idea,
> so that everyone understands what is being talked about ... Second,
> the separation of the Idea into parts, by dividing it at the joints,
> as nature directs, not breaking any limb in half as a bad carver might.
>
>   -- Plato, Phaedrus (Notes on the Synthesis of Form by C. Alexander)
>
>
>
>
>
>
>
>
>

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


Re: Inject Maven components/parameters to Plexus components

Posted by Jason van Zyl <ja...@takari.io>.
The short answer is that you can't right now. We do not create bindings in the normal JSR330 for configuration injection, we historically use a tool called the PluginParameterExpressionEvaluator to pass over the component once it's instantiated. We did this long before we used any container. As part of the JSR330 work I'm doing I would like to dynamically create bindings so that plugins can be simple POJOs using private/final constructor injection where the bindings get created from the same process we use now except expose this to the container during object instantiation.

Until that happens you can always make a singleton component and pass in your configuration as parameters. If you need to manage state then you'll have to do that yourself with a context of some sort.

On Jun 23, 2014, at 8:33 AM, Simone Tripodi <si...@apache.org> wrote:

> Hi all mates,
> 
> I am a little lost and I would like to kindly ask you if anyone knows
> how to request, via Plexus annotations, the injection of Maven
> parameters/components.
> 
> While for components I guess it is more or less the same as in MOJOs,
> just using different kind annotations, it is not clear to me if it is
> possible, and how, to request a MOJO parameter injection inside a
> Plexus component, i.e. the ${project.groupId} or
> ${project.remotePluginRepositories}
> 
> Many thanks in advance, all the best!
> -Simo
> 
> http://people.apache.org/~simonetripodi/
> http://twitter.com/simonetripodi
> 
> ---------------------------------------------------------------------
> 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
http://twitter.com/takari_io
---------------------------------------------------------

First, the taking in of scattered particulars under one Idea,
so that everyone understands what is being talked about ... Second,
the separation of the Idea into parts, by dividing it at the joints,
as nature directs, not breaking any limb in half as a bad carver might.

  -- Plato, Phaedrus (Notes on the Synthesis of Form by C. Alexander)