<hasNature>

Scope: All Project Types

Description

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 "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.

For convenience reasons this condition has some shortcuts builtin, so you don't need to know the exact ID. Following shortcuts are supported:

Arguments

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

Examples

You can either use the hasNature condition in places where Ant supports Conditions or you can use it in conjunction with the If-task of the ant-contrib project. The If-task is an elegant way to write build steps depending on certain conditions. The hasNature condition takes as arguments the location of a workspace, the name of the project inside the workspace and the name of the nature that should be checked.