Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Ant not getting environment on MacOSX when running within Eclipse(Ant not getting environment on MacOSX when running within Eclipse)
Ant not getting environment on MacOSX when running within Eclipse [message #520236] Thu, 11 March 2010 16:32
Timothy Mowlem is currently offline Timothy MowlemFriend
Messages: 4
Registered: July 2009
Junior Member
Hello,

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:

PATH=/usr/bin:/bin:/usr/sbin:/sbin

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_


Thank you.

Tim Mowlem
Previous Topic:Give an argument to the swtbot test on run
Next Topic:Create TestSuit
Goto Forum:
  


Current Time: Sat Nov 22 15:55:11 GMT 2014

Powered by FUDForum. Page generated in 0.02583 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software