Using the Java System Property
You can pass a variable as an argument to the JVM. Assuming you have a variable called "screenShotRoot" defined as follows
ant -DscreenShotRoot=/screenshots/testcases
you can read it in build.xml file like this
<property name="screenshot.root" value="${screenShotRoot}" />
Then your ANT task can use this root path to create the appropriate paths to your PNG files on the expected date.
See this Apache ANT FAQ page.
Using environment variables
You can also use operating system environment variables by setting them before calling the script. Assuming you have an environment variable called "screenShotRoot" defined like this on Windows
SET screenShotRoot=/screenshots/testcases
you can read it in build.xml file like this
<property environment="env"/> <property name="screenshot.root" value="${env.screenShotRoot}" />
Using Property Files
You can also write your links to a properties file that loads your ANT script, for example
<property file="build.properties"/>
Brad
source share