PrintStackTrace task

Sets the stack trace of a java.lang.Throwable object to a property. This task is intended to be used in conjunction with the tryCatch task provided by Ant-Contrib.

Parameters

Attribute Description Required
property The name of the property to set. Yes
refid The reference ID of the java.lang.Throwable object. Yes

Examples

The following example catches any exceptions occurred when running Ant with extract.xml and prints the entire stack trace to the console, as opposed to only the exception message as Ant does by default.

 <trycatch reference="throwable">
    <try>
        <ant antfile="extract.xml" />
    </try>
    <catch>
        <printStackTrace refid="throwable" property="stackTrace" />
        <echo message="${stackTrace}" />
    </catch>
</trycatch>