ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Bouteille <CyrilBoutei...@yahoo.com>
Subject Re: reading system variables?
Date Tue, 14 Nov 2000 21:12:26 GMT
Hadi,

> Thanks Cyril, it helped. So Should I assume that any arbitrary system
> variables that I define, like MYPATH, I must pass it in as arguments to Ant?
> is that true?

I'm not sure there's no other way, but that's the only one I found. :)
I currently use my own ant script which invoke the ant main class with
-D properties in order to make my build.xml file portable to different
environments.

> How about if I am running it on a UNIX platform, do I still
> use -DOS? 

I think there's a little confusion here. When I said you can start ant
with -Dos.path=$PATH, it has nothing to do with DOS. -Dkey=value is a
standard java option allowing you to pass properties to the JVM. I used
the property name "os.path" as a an example (OperatingSystem.PATH) but
you can use any name you want.

> Also, is there a list of predefined properties for Ant?

You can see all the standard properties by running
$ ant -debug
You'll see a bunch of "Setting project property:" lines.

Regards,

> -----Original Message-----
> From: Cyril Bouteille [mailto:CyrilBouteille@yahoo.com]
> Sent: Tuesday, November 14, 2000 11:10 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: reading system variables?
> 
> Hadi,
> 
> > Is there a way to read the System variables like PATH or CLASSPATH with
> Ant?
> 
> You can access the CLASSPATH variable using ${java.class.path} in Ant.
> 
> For the PATH, you can start ant with -Dos.path=$PATH and access it in
> Ant using ${os.path}.
> 
> Hope it helps,
Mime
View raw message