Take the 2-minute tour ×

I am trying to exec git describe in ant from inside eclipse. I have the following inside one of my targets:

<exec  executable="git" outputproperty="git-desc">
    <arg value="describe"/>

When I try this from command line, ant runs properly as it uses the PATH set by my shell. When I try to run ant from eclipse, I get the following error:

Cannot run program "git": error=2, No such file or directory

It seems pretty clear that I need to update the PATH that eclipse is given. How do I go about doing this?

share|improve this question
Are you using some kind of plugin for git inside Eclipse? –  Leniel Macaferi Jul 7 '10 at 4:21

3 Answers 3

up vote 5 down vote accepted

I actually figured this one out on my own. You have to set the PATH environment variable for ant in eclipse.

Step 1: Go to Run->External Tools->External Tools Configurations...

Step 2: Select the ant file you want to run that is trying to execute a command line program

Step 3: Click the Environment tab

Step 4: Click the New button to add a new variable

Step 5: Create a variable named PATH and enter in the paths that you want delimited by :

share|improve this answer

Quoted from http://ant.apache.org/manual/Tasks/exec.html

<property environment="env"/>
<exec ... >

is that what you are searching for?

share|improve this answer
The problem is eclipse doesn't forward the shell at all, especially when not launched from command line. Very annoying. –  Dmitriy Likhten Mar 11 at 13:23

Your Answer


