Skip to Content

Resolving Classpath Variables


Classpath Variables are similar to Classpath Libraries. A Classpath Variable is a single file or directory that will be added to your classpath. When the variable points to an external directory outside of your workspace, you must "extend" it when you add it to your classpath by adding a file from that directory to the classpath.

A classpath entry for a Classpath Variable has set its kind attribute to var ("Variable"). Its path attribute consists of the variable name (eg ANT4ECLIPSE_HOME) and optionally the file that has been specified when adding it to the concrete classpath. For example:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
 ...
 <classpathentry kind="var" path="ANT4ECLIPSE_HOME/libs/ant4eclipse.jar"/>
 ...
</classpath>

To define the value of Classpath Variable in your build file you have to use the jdtClassPathVariable type. The types expects two attributes: a name, that must match the name of your Classpath Variable and a path that must point to the path (file or directory) the variable should point to. To set the ANT4ECLIPSE_HOME Classpath Variable to c:\ant4eclipse, use the following code in your build file:

 <ant4eclipse:jdtClassPathVariable name="ANT4ECLIPSE_HOME" path="c:/ant4eclipse"/>

Note that you can use any number of jdtClasspathVariables in your build file. The declared variables are visible accross your whole build file.