Question

Using Linux environment with java,I'm having the config file which should be configured before executing the eclipse application from console,

This is the OpenspliceDDS config file to source which is in the following directory

source /../HDE/x86.linx2.6./release.com --->Executed at command line

But i need to execute the source command in ANT script can any one help me out in this .

Example :

I have created the property tag for the command

<property name="release.path" location="/opt/HDE/x86.linux2.6/release.com"/>

<exec executable="source ${release.path}" spawn="true">

</exec>
Was it helpful?

Solution

I think you will need to make a wrapper script for Ant to invoke. In the wrapper script, execute the "source" command and then the "sources" command. (You could pass parameters for the file to source and to execute).

Follow up

For the wrapper script, I just mean something like this:

#!/bin/bash

env_file=$1
script_to_exec=$2

. $env_file
exec $script_to_exec

The point being that you need to source a file and then execute a script in the same environment. So wrap those up into a script which you can execute from a different environment (Ant).

To invoke that from Ant, something like this:

    <exec executable="wrapper_script">
        <arg value="${release.path}"/>
        <arg value="script_to_execute"/>
    </exec>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top