You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Hogeweg, Erwin (GE Infrastructure)" <Er...@ge.com> on 2005/09/28 23:07:03 UTC

jelly: How to get a reference to an environment variable?

Hi,

I need a reference to JAVA_HOME in my jelly script but the tag below doesn't seem to work. All I get is "JAVA_HOME=" (w/o the quotes of course).

    <ant:echo message="JAVA_HOME=${env.JAVA_HOME}"/>

So I assume there is a different way to do this but I can not find it.

Any help is highly appreciated.

Thanks,

Erwin

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


Re: jelly: How to get a reference to an environment variable?

Posted by Davy Toch <Da...@belgacom.net>.
Hi,

Different solutions:

   ...
   <!-- Standard Apache ANT task to bind the environment 
     variables to a prefix 'env' -->
   <property environment="env"/>
   
   <!-- solution 1 -->
   <echo>JAVA_HOME : ${env.JAVA_HOME}</echo>
   ...
   <!-- just for your information -->
   <echo>Maven variables : ${context.getVariables()}</echo>
   <!-- not the same as JAVA_HOME -->
   <echo>Maven JRE : ${context.getVariable("java.home")}</echo>

   <!-- solution 2 :  can only be done because '... property 
   environment="env" ...' called -->
   <echo>Maven JAVA_HOME : ${context.getVariable("env.JAVA_HOME")}</echo>
   ...

Regards,
Davy Toch

On Wednesday 28 September 2005 22:07, Hogeweg, Erwin (GE Infrastructure) 
wrote:
> Hi,
>
> I need a reference to JAVA_HOME in my jelly script but the tag below
> doesn't seem to work. All I get is "JAVA_HOME=" (w/o the quotes of course).
>
>     <ant:echo message="JAVA_HOME=${env.JAVA_HOME}"/>
>
> So I assume there is a different way to do this but I can not find it.
>
> Any help is highly appreciated.
>
> Thanks,
>
> Erwin
>
> ---------------------------------------------------------------------
> 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: jelly: How to get a reference to an environment variable?

Posted by Doug Douglass <dd...@denverdata.com>.
Try getting it via the System property "java.home":

<ant:echo message="${context.getVariable('java.home')}"/>


Hogeweg, Erwin (GE Infrastructure) wrote:

>Hi,
>
>I need a reference to JAVA_HOME in my jelly script but the tag below doesn't seem to work. All I get is "JAVA_HOME=" (w/o the quotes of course).
>
>    <ant:echo message="JAVA_HOME=${env.JAVA_HOME}"/>
>
>So I assume there is a different way to do this but I can not find it.
>
>Any help is highly appreciated.
>
>Thanks,
>
>Erwin
>
>---------------------------------------------------------------------
>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