Ant exec task
20 May 2008To execute a system command from Ant, exec is used. Since different operating systems have different commands, therefore OS commands (if used), will restrict the build script to a particular operating system.
One cannot interact with the forked program and if any attempt to read input in the forked program is made, an EOF (-1) will be thrown.
The
<target name="help"> <exec executable="cmd"> <arg value="/c"/> <arg value="ant.bat"/> <arg value="-p"/> </exec> </target>
Review the following example:
<exec dir="${src}" executable="cmd.exe" os="Windows 2000" output="dir.txt"> <arg line="/c dir"/> </exec>
Let me briefly explain the parameters of exec:
dir - specifies the directory in which the command should be executed.
executable - specifies the command to execute without any command line arguments.
os - specifies the Operating Systems on which the command may be executed.
output - specifies the file to which the output of the command should be redirected.
Hope this helps.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Ant exec task