Tasks are instantiated by task factories, and they are called at most once in their lifetime. Tasks receive a context object as a parameter during execution which can be used to communicate with the build system appropriately.
It is a common scenario that tasks require to be parameterized by external agents. This is supported by implementing ParameterizableTask, which have an appropriate method that is used for initializing the parameters. Clients of the Task interface should handle if the tasks implement this extension interface.
Tasks are always run on the appropriate worker machine and will not be called through RMI.
Tasks can return instances of StructuredTaskResult as their result which should be handled specially. See the documentation for the interface for more information. Task results should be serializable, preferably Externalizable.
Tasks may throw an exception during execution which will cause the build execution to abort with that exception.
public R | run( Executes this task. |
If this task is an intance of ParameterizableTask, then
ParameterizableTask.initParameters(
This method is called at most once during the lifetime of the task object.