Using exec tag in Ant from Eclipse. How do I extend the PATH?
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"/>
</exec>
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?
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 :
Quoted from http://ant.apache.org/manual/Tasks/exec.html
<property environment="env"/>
<exec ... >
<env key="PATH" path="${env.PATH}:${basedir}/bin"/>
</exec>
is that what you are searching for?
精彩评论