Skip to Content

Accessing project informations

Retrieving the project directory

The ant task'getProjectDirectory'

Example usage:

<pre>
&lt;ant4eclipse:getProjectDirectory workspacedirectory=&quot;${workspace}&quot;
                                 projectname=&quot;simple.linked.project&quot;
	                         property=&quot;test&quot; /&gt;
</pre>

Checking a project for a specific nature

The ant condition 'hasNature'

Example usage:

<pre>
&lt;antcontrib:if&gt;
    &lt;ant4eclipse:hasNature workspacedirectory=&quot;${workspace}&quot;
                           projectname=&quot;simple.java.project&quot;
                           nature=&quot;org.eclipse.jdt.core.javanature&quot; /&gt;
  &lt;antcontrib:then&gt;
    ...
  &lt;/antcontrib:then&gt;
&lt;/antcontrib:if&gt;
</pre>

Checking a project for a specific build command

To check whether a given eclipse contains a specific build command or not, you can use ant4eclipse's hasBuildCommand condition.

Example usage:

<pre>
&lt;antcontrib:if&gt;
  &lt;ant4eclipse:hasBuildCommand workspacedirectory=&quot;${workspace}&quot;
                               projectname=&quot;simple.java.project&quot;
                               buildcommand=&quot;org.eclipse.jdt.core.javabuilder&quot; /&gt;
  &lt;antcontrib:then&gt;
    ...
  &lt;/antcontrib:then&gt;
&lt;/antcontrib:if&gt;
</pre>

Iterating over build commands

executeBuildCommands

Example usage:

<pre>
&lt;ant4eclipse:executeBuildCommands workspacedirectory=&quot;${workspace}&quot;
			          projectname=&quot;simple.java.project&quot;&gt;
 
	&lt;org.eclipse.jdt.core.javabuilder&gt;
		...
	&lt;/org.eclipse.jdt.core.javabuilder&gt;
 
&lt;/ant4eclipse:executeBuildCommands&gt;
</pre>