jQuery in Action, 3rd edition
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
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/setWLSEnv.sh"/>

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


/home/ser/minu/test/build.xml:3: Execute failed: java.io.IOException: Cannot run program "source": java.io.IOException: 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/commEnv.sh

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 setWLSEnv.sh 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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Using exec task
It's not a secret anymore!