aspose file tools*
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
Author

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"/>
</exec>
</target>
</project>


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

test:

BUILD FAILED
/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!


SCBCD5, SCWCD5, SCJP5
"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
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

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
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using exec task