| <!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=utf-8"> |
| <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 > About Eclipse > Installation Details > 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, open the <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.svg" alt="command link"> <b>Ant > Runtime</b></a> |
| preference page. 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.svg" alt="command link"> <b>Run > External Tools > 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> |
| <h3 class="related">Related concepts</h3><a href="../concepts/concepts-antsupport.htm">Ant Support</a><br> |
| <a href="../concepts/concepts-exttools.htm">External tools</a> |
| <h3 class="related">Related tasks</h3><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> |
| </body> |
| </html> |