4

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>
Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
thar45
  • 3,518
  • 4
  • 31
  • 48

1 Answers1

5

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>
ewan.chalmers
  • 16,145
  • 43
  • 60
  • please give some samples,to write the wrapper script and to invoke from ANT – thar45 Jun 27 '12 at 04:39
  • @sudocode I know this is old, but could you provide a more concrete example for me to understand? I mean without the variables so I can better visualize what the variables mean. – hbhakhra Nov 05 '12 at 14:35