Skip to Content
Scope: All Project Types


The hasNature condition is an Ant condition that can be used to check if a project has a specific nature. Natures are used to assign specific behaviour to Eclipse projects. Java projects for example have the nature 'org.eclipse.jdt.core.javanature'.

The hasNature 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 a project has some specific nature.


The hasNature 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
nature Name of a Nature that should be checked yes

Example usage

The following example checks if the project with the name '' has the nature 'org.eclipse.jdt.core.javanature':

    <ant4eclipse:hasNature workspacedirectory="${workspace}"
                           nature="org.eclipse.jdt.core.javanature" />