Skip to Content


Scope: All Project Types


The hasBuildCommand condition is an Ant condition that can be used to check if an Eclipse project has a specific build command. An Eclipse project can have several build command assigned to it. Those build commands are normally executed after a file has been saved (incremental build) or when a full build is initiated (Project -> Clean...) (manual build). A typical java project contains the org.eclipse.jdt.core.javabuilder which invokes the default Eclipse compiler on java sources.

If you would like to write build steps that depend on specific build commands, you can use the hasBuildCommand condition which checks if a project has a specified buildCommand. The hasBuildCommand-condition can be used with ant's native condition and waitfor tasks (see Condition Task). It can also be used with the if-task from the ant-contrib project to create build steps that check whether some specific build commands exist or not.


The hasBuildCommand datatype provides the following arguments:

Argument Description Required
workspaceDirectory Absolute path of the workspace directory Either 'workspaceDirectory' or 'workspaceId' has to be specified
workspaceId The identifier of a defined workspace (see <workspaceDefinition>) Either 'workspaceDirectory' or 'workspaceId' has to be specified
projectName Name of the eclipse project yes
buildCommand Name of the build command that should be checked yes

Example usage

The following example checks if the project with the name '' has the build command 'org.eclipse.jdt.core.javabuilder':

  <ant4eclipse:hasBuildCommand workspacedirectory="${workspace}"
                               buildcommand="org.eclipse.jdt.core.javabuilder" />