run batch file on project startup to get environment variables
Hi All - I posted this to the TeamCity forum by mistake....
I need to run a batch file on project startup which will setup some environment variables that are needed in order to run the projects various ant build scripts. I need these enviroment variables to be available to my ant scripts which I run inside of IDEA.
Currently I have a batch file that runs the scripts and then runs IDEA but this only works for one project and I can't have another script in another project which does the same thing because only 1 instance of IDEA can run at once.
This is my current script located in "D:\P4Dev\myproject\dir\setup.bat"
call p4env
call ixmk env
call p4env
call "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 7.0\bin\idea.exe"
What I would like is on project startup I would like it to run just
call p4env
call ixmk env
call p4env
which would be in a file "D:\P4Dev\myproject\dir\setup.bat"
Or if I could just run them each separately would be fine as long as I can run them from the directory "D:\P4Dev\myproject\dir"
I know that I could add the environment variable to the ant properties within IDEA, but there are alot of properties and a lot of build files.
What if I was to write a project plugin that would set the project variables, just like if they were set in the ant properties panel.
How could I set ant build file properties for all ant projects like when you select build file properties and add a property to a single build file, I would want to set them once in my project plugin and then propogate them to all ant build file properties?
Any help is appreciated.
Thanks
Mike
Please sign in to leave a comment.
Why not just put the properties into a file?
This would either be in ${user.home} or the $, then they can be included using the task e.g. ]]>
If the settings were global, then the properties file would be a revision controlled artifact.
Would these enviornment variable settings interfere with other software on your system?
How are the variables being consumed by the ant script or tasks launched from Ant?
Hi Dave,
I can't, these properties are generated by some tools that we have that handles our whole build process. The properties change based on what project is currently installed within the dev folder. We run the tool, which builds and environment. This environment is used within the build.xml files by the normal ant build process.
Typically I like to run the ant build files through intellij itself, instead of running the whole build process from a command line. In order to do that I need to run the environment part of this build process which sets up environment variables used by ant build scripts.
What I need is a way to run this tool at the start of the project, so that all the environment variables are available to the ant build tool within intellij.
Mike