ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: User implementations of custom interfaces can have access to Task instance?
Date Tue, 13 Mar 2018 10:06:14 GMT
On 2018-03-13, Jaikiran Pai wrote:

> I'm looking for some suggestion on whether it's a good/bad idea to
> expose a method to custom user defined classes which takes a "Task"
> object. This is in context of the JUnitLauncher task that I recently
> added. It allows custom report formatters/listeners to be implemented
> and the expectation is that such classes will implement the
> TestResultFormatter interface that is (newly) part of Ant. This
> interface exposes:

> void setTask(Task currentExecutingTask)

> so the implementations of this class have access to the current task
> that's running. Right now, the only reason I exposed that Task
> instance was to allow such implementation to issue log messages from
> within the implementation like:

In that case I'd prefer the formatter implementation to extend
ProjectConponent or just provide a setProject(Project) method.

When your formatter is created by Ant - for example as a nested element
- something like

    public void addConfiguredFormatter(TestFormatter f)

then IntrospectionHelper will see the setProject method and invoke it
with a reference to the current project.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message