What you are attempting simply will not work from within Ant itself without some serious voodoo. If Ant were to invoke your CMD file, it will be creating a new process which will not be affecting the local environment in which Ant was started. As soon as the CMD file is finished, the environment variables set by the CMD file are gone and Ant will not see them. To
test this for yourself, try this:
setenv.cmd
build.xml
Doesn't work.
BUT....
Ant provides a global preprocessing hook. At the beginning of ANT.BAT you will find the line
So you could make sure your HOME environment variable is set to some directory, create a batch file called
antrc_pre.bat and put that in that directory, and have that batch file CALL your CMD file (make sure you use the call command or it will just execute without returning). Downside is that your CMD file would get executed anytime you run Ant on your machine, regardless of the project you're working on.
Hope this helps.
[ August 06, 2006: Message edited by: Matt Harrah ]
[ August 06, 2006: Message edited by: Matt Harrah ]