You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Thanh T." <co...@gmail.com> on 2006/02/22 21:38:58 UTC

Get system/environment variable into MOJO help

Hi all,
I was able to get the POM properties and project into mojo thanks to
Dan Tran and Alexandre Poitras for the help. Now I couldn't get the
environment variables into mojo. Here's my question where can I get a
list parameter expression. For example if I want to pass in the
project build folder i would do.

/**
* @parameter expression="${project.build.directory}"
* ...
*/
private File buildDirectory;

how can I pass the system properties into mojo? i don't know the
expression for system properties. Can anyone point me to a place where
they have a list of expression? I tried to find the default maven 2
properties but couldn't from their site either. thanks

--
Thanh T.ICQ #: 10381946

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


Re: Get system/environment variable into MOJO help

Posted by Napoleon Esmundo Ramirez <nr...@gmail.com>.
Hello,

AFAIK, system properties doesn't have expressions like project properties
do.

Using System.getProperty() will work, but you'd be better off passing
parameters (just like how you mentioned) as the advantages are: you could
inject the values thru the command line and you could specify the parameters
in pom.xml.

Did I get you right?  Kindly correct me if I'm wrong. :)

Cheers!
Nap

On 2/23/06, Thanh T. <co...@gmail.com> wrote:
>
> Hi all,
> I was able to get the POM properties and project into mojo thanks to
> Dan Tran and Alexandre Poitras for the help. Now I couldn't get the
> environment variables into mojo. Here's my question where can I get a
> list parameter expression. For example if I want to pass in the
> project build folder i would do.
>
> /**
> * @parameter expression="${project.build.directory}"
> * ...
> */
> private File buildDirectory;
>
> how can I pass the system properties into mojo? i don't know the
> expression for system properties. Can anyone point me to a place where
> they have a list of expression? I tried to find the default maven 2
> properties but couldn't from their site either. thanks
>
> --
> Thanh T.ICQ #: 10381946
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>