When I run targets on ant it says it is unable to locate the variable I passed to it.
Config for environment variables :
in build.xml
<property environment="Env"/>
but I am unable to find the parameter defined parameter with
${Env.CATALINA_HOME}
where in the .bash_profile
export CATALINA_HOME=/Users/olgunkaya/development/apache-tomcat-7.0.34
and export PATH=${PATH}:$CATALINA_HOME
What can I do to achive this ?
Before you run ant
, check to see if CATALINA_HOME
is actually defined as an environment variable. I bet you'll find it isn't. Ant doesn't read your .profile
or .bash_profile
before starting, so if it's not already defined in your environment, Ant won't see it.
As you've seen opening a terminal window on a Mac doesn't necessarily guarantee that the .bash_profile
file is executed. Try setting up these environment variables in .bashrc
file instead.
Or, you can force .bash_profile
to run by setting it as the Startup file in Terminal. Select File->Preferences from the menu, go to the Shell tab, select your default shell, and then click the Run Command checkbox and put .bash_profile
in there. That will guarantee that .bash_profile
is executed with each new terminal window.