In short, no. You can test it for yourself by writing a simple ant script.  All 
system environment variables have to be preceded by "env.", otherwise, in the 
example below ${HOMEPATH} by itself is meaningless unless you have assigned a 
prior value to it. But the minute it's preceded by "env." it knows you're 
requesting something out of the system environment.  If you comment out, 
<property environment="env"/>, the script will work but ${env.HOMEPATH} will 
just echo as itself w/o a value.

 

<project name="test" basedir="." default="test-target"> 

  <target name="test-target">

 <property environment="env"/>
 <echo>User.Home=${env.HOMEPATH}</echo>

  </target>

</project>

 

 

 
> Date: Tue, 29 Dec 2009 22:56:32 -0800
> From: nagendra.r...@tejasoft.com
> To: user@ant.apache.org
> Subject: Reading environment variables in ant script directly
> 
> 
> Hi,
> 
> Is it possible to read OS environment variables directly in ant script
> without the line
> 
> <property environment="evn"/>
> 
> As ant is java and by default all the ant variables would be passed to JRE
> on each java invocation, I am looking for a way to get the value of the
> property variables directly.
> 
> Why another line if I could avoid it. Also helps in managing few thing more
> smartly without this call each project.
> 
> 
> Regards,
> Raja Nagendra Kumar,
> C.T.O
> www.tejasoft.com
> -- 
> View this message in context: 
> http://old.nabble.com/Reading-environment-variables-in-ant-script-directly-tp26964622p26964622.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
> 
                                          
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/

Reply via email to