Documentation TaskDoc JavaDoc Packages
public interface Task<R>
Tasks are the basic execution units for the build system

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.

RThe return type of the task.
public R
run(TaskContext taskcontext)
Executes this task.
public abstract R run(TaskContext taskcontext) throws Exception
Executes this task.

If this task is an intance of ParameterizableTask, then ParameterizableTask.initParameters(TaskContext, NavigableMap<String, ? extends TaskIdentifier>) will be called prior to this.

This method is called at most once during the lifetime of the task object.

taskcontextThe task context to communicate with the build system.
The result of this task, may be an instance of StructuredTaskResult or any arbitrary object.
ExceptionFor any exception that caused this task to fail.