You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Anthony Fairchild (PureVirtual.com)" <an...@purevirtual.com> on 2000/09/13 21:07:34 UTC

Accessing environment variables in Ant

Does anyone know if it is possible to access an environment variable from an
Ant XML file?  I've tried accessing it as a property with the ${VARNAME}
syntax but it doesnt work.  My project is very complex and requires a number
of env vars to be set up.  The only workaround that I've found is to declare
the env varaibles as properties but that duplicates their definitions.

Please excuse me if this question is already in the FAQ.  The FAQ has
appeared to be down for a few days now.

Thanks,

Anthony


Re: Accessing environment variables in Ant

Posted by Stefan Bodewig <bo...@bost.de>.
>>>> "AF" == Anthony Fairchild <an...@purevirtual.com> writes:

 AF> Does anyone know if it is possible to access an environment
 AF> variable from an Ant XML file?

The problem is that java can't access them - consequently Ant cannot
either.

 AF> The only workaround that I've found is to declare the env
 AF> varaibles as properties but that duplicates their definitions.

You could write a shell script, that picks up all environment
variables and invokes Ant with -DENV_VAR=${ENV_VAR} appended for each
variable.
 
Stefan