We're using
Ant version 1.7.0 and I'm trying to get some build scripts to work cross-platform (Linux and Windows).
The script was referencing a hard-coded UNIX-style path, and I would like to allow the UNIX folks to continue to use the script (I don't want to break what is already working).
What I would like to do is set an environment variable on the Windows machine and have the build script use it if it exists, but fall-back to the original UNIX value if it does not.
I see that I can reference environment variable from within the Ant build script (using ${env.VAR_NAME}), but can't find a way to handle the case where the variable is not set.
What I want is something like this:
Of course, if/then/else statements can't be used in this case.
I tried to use a target, as in:
but this doesn't work.
Note that I don't want to override the "my.dir" property using -Dmy.dir=... on the command line, as we want to be able to just invoke Ant without having to specify all the command-line arguments.
Thanks,