|Ant not getting environment on MacOSX when running within Eclipse [message #520236]
||Thu, 11 March 2010 16:32
| Timothy Mowlem
Registered: July 2009
I am seeing a problem running Ant tasks from the Ant view within Eclipse 3.6M5 on MacOSX 10.6
When I try and run a task via right click on a target to show the context menu, then choose Run As -> Run As Ant task then when Ant tries to run cvs during the import task it fails. Running with verbose set shows:
There is no cvs on that path which causes ant to fail as it cannot find cvs. On my Mac cvs is installed at /Developer/usr/bin so Ant does not find it.
However my ~/.bashrc contains a PATH setting which includes the /Developer/usr/bin directory and my ~/.bash_profile sources ~/.bashrc
This means that when ant is run via Eclipse the shell that ant runs it does not read either shell config files. According to the bash man page this is the case if it is a non-login non-interactive shell which is probably is.
So I created a ~/.MacOSX/environment.plist file with BASH_ENV = ~/.bashrc
According to Apple dev docs loginwindow adds any environment variables present in this file to the environment that GUI applications get when they are launched (an alternative is to add an LSEnvironment entry to the application's info.plist which I have not tried).
If I launch Eclipse via a terminal then it does work and running with -v shows:
PATH=/usr/subversion/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ local/bin:/usr/X11/bin:/System/Library/Frameworks/JavaVM.fra mework/Versions/1.6/Home/bin:/Applications/instantclient:/Us ers/xxx/bin:/usr/local/jboss-zeus/bin:/Developer/usr/bin
So in this case Eclipse probably inherits PATH from the shell and passes it on to Eclipse.
So please can someone tell me:
(1) how does Eclipse launch Ant internally, i.e. what type of shell does it create and where is the environment taken from? If it is from Eclipse then why is Eclipse not picking up the PATH from the shell that it is started from?
(2) can I set the environment somehow for ant within eclipse so it gets the correct PATH?
It doesn't appear so (you can set ant properties but that is different from an environment variable)
For info My Prefs -> Ant -> Runtime has:
All Ant Home entries are paths beginning /Applications/eclipse 3.6M5 64-bit/plugins/org.apache.ant_
All contributed entries are paths beginning with /Users/xxx/.eclipse/org.eclipse.platform_3.5.0_
There is also a contributed entry /Applications/eclipse 3.6M5 64-bit/plugins/org.eclipse.pde.build_
Powered by FUDForum
. Page generated in 0.01582 seconds