Let's say I have a series of setupEnv.bat files in my source repository that I 
need to execute as part of setting up my runtime environment before executing 
my java code with the java task.  I don't see an elegant way of doing this.  I 
could execute these bat files as part of my build.bat before invoking ant 
itself.  However, I don't like this approach as it would interfere with my 
build environment.  I only want it to affect my runtime environment when I 
launch java code from my build.xml.  For example, my "build.bat compile" 
command should not invoke the setupEnv.bat files, but my "build.bat launch" 
command should.  I don't want to start writing a lot of logic in my simple 
build.bat script which just launches ant to detect what target is being run to 
know whether to invoke the setupEnv.bat files.  I was hoping for something more 
elegant inside ANT itself.  The java task already provides a way to pass in 
environment variables, but I don't see how I could have it execute some bat 
files first to setup the environment.

Does anybody know of an elegant way of doing this or some 3rd party ant plugin 
that can do it?

I don't even know if it is possible in java.  You would have to somehow invoke 
a separate process and then feed it commands to run (like executing batch 
files) to setup its environment, and then pass it the JVM command line to 
finally invoke the java class.

---
Shawn Castrianni

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are 
not the intended recipient (or authorized to receive information for the 
intended recipient), please contact the sender by reply e-mail and delete all 
copies of this message.

Reply via email to