<executeBuilders>

Scope: Java Projects

Description

The executebuilders tasks executes for each builder defined in a .project file an Ant target. This task allows you to write generic, reusable build scripts that can be shared across projects.

The name of the target that is actually executed for a specific builder is determined by the tasks in the following steps (first match wins):

  1. if an Ant Property called builder. full-buildcommand-name.target is defined, its value will be used as the target name
  2. if an Ant Property called builder. buildcommand-name.target is defined, its value will be used as the target name
  3. If a target exists in the current project, that is called exactly as the build command's name, this target will be executed
  4. If a target exists in the current project, that is called as the buildcommand-name this target will be executed
  5. If the task's argument defaultTargetName is set and exists in the project this target will be executed. If defaultTargetName is not null, but the target does not exists the task fails
  6. If a target exists with the name default-builder this target will be executed
  7. In all other cases the tasks fails (i.e. throws a BuildException)

Note: full-buildcommand-name is the complete name of a buildCommand as defined in the .project-file, like org.eclipse.jdt.core.javabuilder while buildcommand-name is the "unqualified" name of a builder, like javabuilder.

"Context" Before a target is executed an Ant property called "current.buildcommand" is set that contains the name of the buildCommand, as specified in the .project file. This property can used if you have implemented a generic default task to determine for which missing builder the default task has been invoked.

Arguments

Note You can specify either the path to the project (using the project argument) or you can specify the path to the workspace ( workspace argument) and the name of the project ( projectName argument).

Argument Description Required
project Path to the project for which the output path should be build either the project or the combination of workspace and projectName has to be specified.
workspace Path to the workspace containing the projects
projectName Name of the project inside of the workspace for which the output path should be build
initialiseWorkspace Set to 'true' if your workspace contains projects which have project names that differ from the names of their project folders and the workspace doesn't contain a .metadata directory. no (default: false)
defaultTargetName The name of a target that should be executed if for a buildCommand no matching target could be found. no; defaults to default-builder
variablesRef The ID of an ant property set. This property set will be used to resolve Eclipse variables. This allows to prefer a specific set of properties rather than using the ant properties in general. no

Examples

Imagine you have the following builders defined in a .project file:

  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
    </buildCommand>
    <buildCommand>
      <name>com.mycompany.rmicbuilder</name>
    </buildCommand>
    <buildCommand>
      <name>com.mycompany.xdocletrunner</name>
    </buildCommand>
    <buildCommand>
      <name>some.strange.builder</name>
    </buildCommand>
  </buildSpec>
		

Consider the following build.xml snippet:

This would execute the targets javabuilder, build.rmic, com.mycompany.xdocletrunner and default-builder (since no target could be determined for the buildcommand some.strange.builder.