next up previous contents index
Next: Record Up: Property Previous: Parameters   Contents   Index

Parameters specified as nested elements

classpath

Property's classpath attribute is a PATH like structure and can also be set via a nested classpath element.

Examples

  <property name="foo.dist" value="dist"/>
sets the property foo.dist to the value "dist".
  <property file="foo.properties"/>
reads a set of properties from a file called "foo.properties".
  <property resource="foo.properties"/>
reads a set of properties from a resource called "foo.properties".

Note that you can reference a global properties file for all of your Ant builds using the following:

  <property file="${user.home}/.ant-global.properties"/>
since the "user.home" property is defined by the Java virtual machine to be your home directory. This technique is more appropriate for Unix than Windows since the notion of a home directory doesn't exist on Windows. On the JVM that I tested, the home directory on Windows is "C:. Different JVM implementations may use other values for the home directory on Windows.
  <property environment="env"/>
  <echo message="Number of Processors = ${env.NUMBER_OF_PROCESSORS}"/>
  <echo message="ANT_HOME is set to = ${env.ANT_HOME}"/>
reads the system environment variables and stores them in properties, prefixed with "env". Note that this only works on select operating systems. Two of the values are shown being echoed.


next up previous contents index
Next: Record Up: Property Previous: Parameters   Contents   Index
Andrew Marlow 2003-07-08