org.apache.tools.ant.taskdefs

Class Exec

public class Exec extends Task

Deprecated: since 1.2. delegate to Execute instead.

Executes a given command if the os platform is appropriate.

As of Ant 1.2, this class is no longer the implementation of Ant's <exec> task - it is considered to be dead code by the Ant developers and is unmaintained. Don't use it.

Field Summary
protected PrintWriterfos
Constructor Summary
Exec()
Constructor for Exec.
Method Summary
voidexecute()
Execute the task.
protected voidlogFlush()
Close output.
protected voidoutputLog(String line, int messageLevel)
Log an output message.
protected intrun(String command)
Execute the command.
voidsetCommand(String command)
Set the command to exec.
voidsetDir(String d)
Set the directory.
voidsetFailonerror(boolean fail)
Set the failOnError attribute.
voidsetOs(String os)
Set the Operating System that this exec is to run in.
voidsetOutput(String out)
Set the output filename.

Field Detail

fos

protected PrintWriter fos

Constructor Detail

Exec

public Exec()
Constructor for Exec. Prints a warning message to std error.

Method Detail

execute

public void execute()
Execute the task.

Throws: BuildException on error

logFlush

protected void logFlush()
Close output.

outputLog

protected void outputLog(String line, int messageLevel)
Log an output message.

Parameters: line the line to putput messageLevel the level of logging - ignored if output is going to a file

run

protected int run(String command)
Execute the command.

Parameters: command the command to exec

Returns: the exit value of the command

Throws: BuildException on error

setCommand

public void setCommand(String command)
Set the command to exec.

Parameters: command a String value

setDir

public void setDir(String d)
Set the directory.

Parameters: d a String value

setFailonerror

public void setFailonerror(boolean fail)
Set the failOnError attribute. Default is false.

Parameters: fail a boolean value

setOs

public void setOs(String os)
Set the Operating System that this exec is to run in.

Parameters: os a String value

setOutput

public void setOutput(String out)
Set the output filename.

Parameters: out a String value