Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Exit

extends Task
Class Inheritance
Imports
org.apache.tools.ant.BuildException, .ExitStatusException, .Project, .PropertyHelper, .Task, org.apache.tools.ant.taskdefs.condition.Condition, .ConditionBase

Exits the active build, giving an additional message if available. The if and unless attributes make the failure conditional -both probe for the named property being defined. The if tests for the property being defined, the unless for a property being undefined. If both attributes are set, then the test fails only if both tests are true. i.e.
fail := defined(ifProperty) && !defined(unlessProperty)
A single nested<condition> element can be specified instead of using if/unless (a combined effect can be achieved using isset conditions).
Since
Ant 1.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Object
private String
private Exit.NestedCondition
private Integer
private Object
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public
Exit()

Method Summary

Modifier and TypeMethod and Description
public void
addText(String
the message to display
msg
)

Set a multiline message.

public ConditionBase

Returns:

ConditionBase.
createCondition
()

Add a condition element.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Throw a BuildException to exit (fail) the build.
private boolean
private boolean

Returns:

boolean.
nestedConditionPresent
()

test whether there is a nested condition.

public void
setIf(Object
property name or evaluated expression
c
)

Only fail if the given expression evaluates to true or the name of an existing property.

public void
setIf(String
property name or evaluated expression
c
)

Only fail if the given expression evaluates to true or the name of an existing property.

public void
setMessage(String
message to output
value
)

A message giving further information on why the build exited.

public void
setStatus(int
the int status
i
)

Set the status code to associate with the thrown Exception.

public void
setUnless(Object
property name or evaluated expression
c
)

Only fail if the given expression evaluates to false or tno property of the given name exists.

public void
setUnless(String
property name or evaluated expression
c
)

Only fail if the given expression evaluates to false or tno property of the given name exists.

private boolean

Returns:

true if there is no if condition, or the named property exists
testIfCondition
()

test the if condition

private boolean

Returns:

true if there is none, or it evaluates to true
testNestedCondition
()

test the nested condition

private boolean

Returns:

true if there is no unless condition, or there is a named property but it doesn't exist
testUnlessCondition
()

test the unless condition

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

ifConditionback to summary
private Object ifCondition
messageback to summary
private String message
nestedConditionback to summary
private Exit.NestedCondition nestedCondition
statusback to summary
private Integer status
unlessConditionback to summary
private Object unlessCondition

Constructor Detail

Exitback to summary
public Exit()

Method Detail

addTextback to summary
public void addText(String msg)

Set a multiline message.

Parameters
msg:String

the message to display

createConditionback to summary
public ConditionBase createCondition()

Add a condition element.

Returns:ConditionBase

ConditionBase.

Since
Ant 1.6.2
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Throw a BuildException to exit (fail) the build. If specified, evaluate conditions: A single nested condition is accepted, but requires that the if/unless attributes be omitted. If the nested condition evaluates to true, or the ifCondition is true or unlessCondition is false, the build will exit. The error message is constructed from the text fields, from the nested condition (if specified), or finally from the if and unless parameters (if present).

Annotations
@Override
Exceptions
BuildException:
on error
isNullOrEmptyback to summary
private boolean isNullOrEmpty(Object value)
nestedConditionPresentback to summary
private boolean nestedConditionPresent()

test whether there is a nested condition.

Returns:boolean

boolean.

setIfback to summary
public void setIf(Object c)

Only fail if the given expression evaluates to true or the name of an existing property.

Parameters
c:Object

property name or evaluated expression

Since
Ant 1.8.0
setIfback to summary
public void setIf(String c)

Only fail if the given expression evaluates to true or the name of an existing property.

Parameters
c:String

property name or evaluated expression

setMessageback to summary
public void setMessage(String value)

A message giving further information on why the build exited.

Parameters
value:String

message to output

setStatusback to summary
public void setStatus(int i)

Set the status code to associate with the thrown Exception.

Parameters
i:int

the int status

setUnlessback to summary
public void setUnless(Object c)

Only fail if the given expression evaluates to false or tno property of the given name exists.

Parameters
c:Object

property name or evaluated expression

Since
Ant 1.8.0
setUnlessback to summary
public void setUnless(String c)

Only fail if the given expression evaluates to false or tno property of the given name exists.

Parameters
c:String

property name or evaluated expression

testIfConditionback to summary
private boolean testIfCondition()

test the if condition

Returns:boolean

true if there is no if condition, or the named property exists

testNestedConditionback to summary
private boolean testNestedCondition()

test the nested condition

Returns:boolean

true if there is none, or it evaluates to true

testUnlessConditionback to summary
private boolean testUnlessCondition()

test the unless condition

Returns:boolean

true if there is no unless condition, or there is a named property but it doesn't exist

org.apache.tools.ant.taskdefs back to summary

private Class Exit.NestedCondition

extends ConditionBase
implements Condition
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.taskdefs.condition.Condition

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
eval()

Implements org.apache.tools.ant.taskdefs.condition.Condition.eval.

Is this condition true?
Inherited from org.apache.tools.ant.taskdefs.condition.ConditionBase:
addaddAndaddAvailableaddChecksumaddContainsaddEqualsaddFilesMatchaddHttpaddIsFalseaddIsFileSelectedaddIsReferenceaddIsSetaddIsTrueaddNotaddOraddOsaddSocketaddUptodatecountConditionsgetConditionsgetTaskNamesetTaskName

Constructor Detail

NestedConditionback to summary
private NestedCondition()

Method Detail

evalback to summary
public boolean eval()

Implements org.apache.tools.ant.taskdefs.condition.Condition.eval.

Doc from org.apache.tools.ant.taskdefs.condition.Condition.eval.

Is this condition true?

Returns:boolean

true if the condition is true

Annotations
@Override