blob: f41ec9c9a7f00bef3449bdbc04df5c55b6ea2d54 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<HEAD>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css">
<title>Using a different version of Ant</title>
<meta name="keyword" content="ant">
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"> </script>
</HEAD>
<body>
<H1>Using a different version of Ant</H1>
<P> The Eclipse platform provides a recent stable version of Ant as
a plug-in library. The installed version of the org.apache.ant plug-in can be
found in <b>Help &gt; About Eclipse &gt; Installation Details &gt;
Plugins</b>. It is possible to use a different version of Ant, but other versions are not supported or guaranteed to work correctly.
</P>
<p>
There are at least two different ways to use an alternate version of Ant in Eclipse:
</p>
<dl>
<dt><b>Changing the Ant runtime classpath:</b></dt>
<dd>When Ant runs a buildfile, it looks for the necessary classes on the Ant classpath.
The Ant classpath consists of the plug-ins contributing new tasks, types or
libraries, plus the classpath defined in the Ant runtime classpath preferences. To
access the preferences, click
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ant.ui.AntRuntimePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<b>Window &gt; Preferences &gt; Ant &gt; Runtime</b></a>.
The JARs related to Ant 1.7.1 are grouped under the <b>Ant Home Entries</b> item.
To change the Ant Home entries, click on the <b>Ant Home...</b> button and choose the Ant
installation you wish to use.
<p>After you change the Ant classpath, all future Ant builds will use the updated
version instead of the default. To restore the Ant classpath to its original
state, <b>Restore Defaults</b> button on the preference page.
</p>
</dd>
<dt><b>Using Ant as an external tool:</b></dt>
<dd>When changing the Ant classpath is not an option, or if you just want to test
a newer or beta version of Ant, using it as an external tool is an option.
Usually when it is running in the Workbench, the Ant buildfile
itself is considered to be a external tool, but this is not the only way.
To install a binary distribution of Ant as an external tool (<b>Note:</b>
These steps are for Windows, but similar methods can be used for other operating systems):
<ol type="a">
<li>Download and install the binary version of Ant from
<a href="http://ant.apache.org" target="_blank">http://ant.apache.org</a> .</li>
<li>Click
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.externalTools.commands.OpenExternalToolsConfigurations")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<b>Run &gt; External Tools &gt; External Tools...</b></a>.</li>
<li>Click <b>Program</b></li>
<li>Click <b>New</b>.</li>
<li>Enter a name for your external tool (for example, External Ant).</li>
<li>For the <b>Location</b> field, click <b>Browse File System</b>.</li>
<li>Find and select a file called <code>ant.bat</code> (it should be
in the <code>bin</code> folder of your Ant installation).</li>
<li>In the <b>Arguments</b> field enter the arguments for your
buildfile that would normally enter for running the buildfile outside of the
Workbench.</li>
<li>In the <b>Working Directory</b> field enter the directory of your buildfile.</li>
<li>Click <b>Run</b> to execute the buildfile.</li>
</ol>
<p>When you run Ant as an external tool, none of the tasks or types
contributed by Eclipse will work. Also, the Ant classpath preference has no
effect in the buildfile execution.
</p>
</dd>
</dl>
<p><img border="0" src="../images/ngrelc.png" alt="Related concepts" ><br>
<a href="../concepts/concepts-antsupport.htm">Ant Support</a><br>
<a href="../concepts/concepts-exttools.htm">External tools</a>
</p>
<p><img border="0" src="../images/ngrelt.png" alt="Related tasks" ><br>
<a href="./tasks-ant-running.htm">Running Ant buildfiles</a><br>
<a href="../tasks/tasks-exttools-running.htm">Running external tools</a><br>
<a href="../tasks/tasks-ant-classpath.htm">Modifying the Ant classpath</a><br>
<a href="../tasks/tasks-ant-addtasksandtypes.htm">Adding new Ant tasks and types</a><br>
</p>
</body>
</HTML>