Java Reference
In-Depth Information
Setting Ant's Classpath
The Additional Classpath tab of the Build File Properties dialog lets you add
libraries and Classpath entries to Ant's runtime environment. Ant loads its Class-
path to your project separately, so you may need to modify these settings to get
your Ant script to run properly under IDEA . The reason is that Ant build scripts
should be made as if they were to be run from the command-line Ant tool outside
of IDEA . This means the scripts themselves should be written in such a way that
they configure themselves to load the libraries they require.
To add a JAR or directory to the additional Classpath, click the Add button
and browse to the desired JAR or directory. Select the item, and click OK . As a
convenience, you can hold down the Ctrl key and select multiple resources at a
time. Sometimes you may have many JAR files in a single directory that you need
to add to the Classpath. If this is the case, click the Add All in Directory button,
and select the directory in the directory browser. Clicking OK with this option
adds the directory into the Classpath list. It appears as a typical directory; but
when Ant runs, it loads all the JAR files contained in that directory into the addi-
tional Classpath.
The other features in this dialog reorder and remove items in the additional
Classpath. The order of the Classpath can be important; by selecting one or more
items in the list and clicking the Move Up or Move Down button, you can change
the order in which Ant loads the resources. Finally, removing an item from the
Classpath is a simple matter of selecting the item and clicking Remove .
Many of Ant's optional tasks require additional libraries that must be
added to the Classpath in order to function. If your targets will be us-
ing XSLT , for example, you must add the xalan library or other XSL
package to Ant's Classpath. Although you could add the library into the
Additional Classpath dialog as just described, it's handier to set up Ant
externally in case you ever need to run Ant scripts outside of IDEA . See
Ant's documentation for details on task requirements.
NOTE
Controlling the target list view
Most Ant scripts are composed of many targets, some of which are used internally
by other targets and weren't designed to be called directly. By default, the Ant
Build window displays all the targets defined in your build file. To limit the list of
targets, click the Filter targets button on the Ant toolbar. The default filter shows
only the primary targets. To modify the filter and select specific targets to appear,
select the Filters tab of the Build File Properties dialog, as shown in figure 5.16.
 
 
 
 
 
 
Search WWH ::




Custom Search