|
Using environment variables in Ant: environment variables are not evaluated |
|
Facts -
Other software technologies
|
|
Thursday, 15 October 2009 18:37 |
|
This note applies to ant version 1.7.1.
From Ant script environment variables can be used, for example ${env.JAVA_HOME} evaluates to
environment variable JAVA_HOME. Do not forget to define the prefix "env" in your ant script. This
can be done by adding the following line to the beginning of your ant build script:
<property environment="env"/>
If you forget this line then environment variables (e.g. ${env.JAVA_HOME} will not be defined inside your build script.
The reason for setting the prefix is to prevent name clashes: properties read from
property files can be prefixed as well. Prefixing all properties from a property
file can be done using the prefix attribute of the ant property task.
|