The moose likes Ant, Maven and Other Build Tools and the fly likes Using exec task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Using exec task" Watch "Using exec task" New topic

Using exec task

Minu Jain
Ranch Hand

Joined: Mar 24, 2008
Posts: 74
Hi All,
I am trying to run a script using the source command through the following build.xml:

<project name="Sample" default="test">
<target name="test">
<exec executable="source">
<arg line="/opt/bea/wlserver_10.3/server/bin/"/>

I get the following error on running this:
Buildfile: build.xml


/home/ser/minu/test/build.xml:3: Execute failed: Cannot run program "source": error=2, No such file or directory

Total time: 0 seconds

Could anyone tell me what could be the problem?

Thanks in advance!

"Even if you're on the right track, you'll get run over if you just sit there."
Minu Jain
Ranch Hand

Joined: Mar 24, 2008
Posts: 74
Also, if instead I run the above script by directly typing the command on the prompt like this

source /opt/bea/wlserver_10.3/common/bin/

it works fine.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

The "executable" property of <exec> must be a an executable file. "source' is not an executable file, rather it is a command built into the shell. Besides, I doubt that sourcing a shell within an Ant script will get you what you want - the environment set by will not be retained for any subsequent shells that you invoke.

JBoss In Action
Minu Jain
Ranch Hand

Joined: Mar 24, 2008
Posts: 74
I agree. Here's the link:
subject: Using exec task
It's not a secret anymore!