Home
Ant tasks
Rational Application Developer v7.5 includes Ant v1.7.
A comprehensive set of built-in tasks is supplied with the Ant distribution. The tasks that we use in our example are as follows:
delete Deletes files and directories echo Outputs messages jar Creates Java archive files javac Compiles Java source mkdir Creates directories tstamp Sets properties containing date and time information To find out more about Ant, visit the Ant Web site.
This chapter provides a basic outline of the features and capabilities of Ant. For complete information, you should consult the Ant documentation.
How do I redirect standard input or standard output in the <exec> task?
Say you want to redirect the standard output stream of the m4 command to write to a file, something like:
shell-prompt> m4 foo.m4 > foo...and try to translate it into...
<exec executable="m4"> <arg value="foo.m4"/> <arg value=">"/> <arg value="foo"/> </exec>This will not do what you expect. The output redirection is performed by your shell, not the command itself, so this should read:
<exec executable="/bin/sh"> <arg value="-c" /> <arg value="m4 foo.m4 > foo" /> </exec>Note that use the value attribute of <arg> in the last element, in order to have the command passed as a single, quoted argument. Alternatively, you can use:
<exec executable="/bin/sh"> <arg line='-c "m4 foo.m4 > foo"'/> </exec>Note the double-quotes nested inside the single-quotes.