ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 46331] New: Get the related Task object from the Condition implementation object
Date Wed, 03 Dec 2008 11:36:23 GMT

           Summary: Get the related Task object from the Condition
                    implementation object
           Product: Ant
           Version: 1.7.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks

When a custom condition is implemented (Condition interface), there is no
direct way to get the related Ant Task.
This is useful - for logging purpose - to link a logged message to the related

In the example below, I want to associated the message logged in the Groovy
script to the waitfor task, because I use XmlLogger to generate my report and
the message must be associated to the task XML element to be properly displayed
in the HTML report.
The workaround consists in setting an id to the waitfor task to be able to get
them through project references.
But, I've read in Ant manual that setting an id for task won't be supported in
Ant future versions:

Example (and workaround):
        <waitfor maxwait="${maxwait}" maxwaitunit="${maxwait.unit}"
                 checkevery="${checkevery}" checkeveryunit="${checkevery.unit}"
            <scriptcondition language="groovy" value="false">
                import groovy.sql.Sql

                def sql = Sql.newInstance(
                    "${dbUserViewer}", "${dbUserViewerPassword}",

                def fields = []
                def row = sql.firstRow("${sqlQuery}", fields)
                def task = project.references.DataInsWaitDvAvailable_waitfor

                project.log(task, "Count=${row[0]}
(expected=${expectedCount})", project.MSG_INFO)

                if (row[0] == (expectedCount as Integer)) {
                } else {

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message