You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

install.html 16 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Installing Ant</title>
  5. </head>
  6. <body>
  7. <h1>Installing Ant</h1>
  8. <h2><a name="getting">Getting Ant</a></h2>
  9. <h3>Binary Edition</h3>
  10. <p>The latest stable version of Ant is available from the Ant web page <a
  11. href="http://ant.apache.org/">http://ant.apache.org/</a>.
  12. If you like living on the edge, you can download the latest version from <a
  13. href="http://cvs.apache.org/builds/jakarta-ant/nightly/">http://cvs.apache.org/builds/jakarta-ant/nightly/</a>.</p>
  14. <h3>Source Edition</h3>
  15. <p>If you prefer the source edition, you can download the source for the latest Ant release from <a href="http://ant.apache.org/srcdownload.cgi">http://ant.apache.org/srcdownload.cgi</a>.
  16. Again, if you prefer the edge, you can access
  17. the code as it is being developed via CVS. The Jakarta website has details on
  18. <a href="http://jakarta.apache.org/site/cvsindex.html" target="_top">accessing CVS</a>. Please checkout the
  19. jakarta-ant module.
  20. See the section <a href="#buildingant">Building Ant</a> on how to
  21. build Ant from the source code.
  22. You can also access the
  23. <a href="http://cvs.apache.org/viewcvs/jakarta-ant/" target="_top">
  24. Ant CVS repository</a> on-line. </p>
  25. <hr>
  26. <h2><a name="sysrequirements">System Requirements</a></h2>
  27. Ant has been used successfully on many platforms, including Linux,
  28. commercial flavours of Unix such as Solaris and HP-UX,
  29. Windows 9x and NT, Novell Netware 6 and MacOS X.
  30. <p>
  31. To build and use Ant, you must have a JAXP-compliant XML parser installed and
  32. available on your classpath.</p>
  33. <p>
  34. The binary distribution of Ant includes the latest version of the
  35. <a href="http://xml.apache.org/xerces2-j/index.html">Apache Xerces2</a> XML parser.
  36. Please see
  37. <a href="http://java.sun.com/xml/" target="_top">http://java.sun.com/xml/</a>
  38. for more information about JAXP.
  39. If you wish to use a different JAXP-compliant parser, you should remove
  40. <code>xercesImpl.jar</code> and <code>xml-apis.jar</code>
  41. from Ant's <code>lib</code> directory.
  42. You can then either put the jars from your preferred parser into Ant's
  43. <code>lib</code> directory or put the jars on the system classpath.</p>
  44. <p>
  45. For the current version of Ant, you will also need a JDK installed on
  46. your system, version 1.1 or later. Some tasks work better on post-1.1 systems;
  47. some tasks only work on Java 1.2 and successors.
  48. A future version of Ant -Ant 2.0- will require JDK 1.2 or later, though
  49. Ant 1.x strives to retain 1.1 compatibility.
  50. </p><p>
  51. <strong>Note: </strong>The Microsoft JVM/JDK is not adequate on its own, although the MS
  52. compiler is supported.
  53. </p>
  54. <p>
  55. <strong>Note #2: </strong>If a JDK is not present, only the JRE runtime, then many tasks will not work.
  56. </p>
  57. <hr>
  58. <h2><a name="installing">Installing Ant</a></h2>
  59. <p>The binary distribution of Ant consists of the following directory layout:
  60. <pre>
  61. ant
  62. +--- bin // contains launcher scripts
  63. |
  64. +--- lib // contains Ant jars plus necessary dependencies
  65. |
  66. +--- docs // contains documentation
  67. | +--- ant2 // a brief description of ant2 requirements
  68. | |
  69. | +--- images // various logos for html documentation
  70. | |
  71. | +--- manual // Ant documentation (a must read ;-)
  72. |
  73. +--- etc // contains xsl goodies to:
  74. // - create an enhanced report from xml output of various tasks.
  75. // - migrate your build files and get rid of 'deprecated' warning
  76. // - ... and more ;-)
  77. </pre>
  78. Only the <code>bin</code> and <code>lib</code> directories are
  79. required to run Ant.
  80. To install Ant, choose a directory and copy the distribution
  81. file there. This directory will be known as ANT_HOME.
  82. </p>
  83. <table width="80%">
  84. <tr>
  85. <td colspan="2">
  86. <b>Windows 95 and Windows 98 Note:</b>
  87. </td>
  88. </tr>
  89. <tr>
  90. <td width="5%">&nbsp;</td>
  91. <td><i>
  92. On these systems, the script used to launch Ant will have
  93. problems if ANT_HOME is a long filename. This is due to
  94. limitations in the OS's handling of the <code>&quot;for&quot;</code>
  95. batch-file statement. It is recommended, therefore, that Ant be
  96. installed in a <b>short</b> path, such as C:\Ant.</i>
  97. </td>
  98. </tr>
  99. </table>
  100. <p>
  101. Before you can run ant there is some additional set up you
  102. will need to do:</p>
  103. <ul>
  104. <li>Add the <code>bin</code> directory to your path.</li>
  105. <li>Set the <code>ANT_HOME</code> environment variable to the
  106. directory where you installed Ant. On some operating systems the ant
  107. wrapper scripts can guess <code>ANT_HOME</code> (Unix dialects and
  108. Windows NT/2000) - but it is better to not rely on this behavior.</li>
  109. <li>Optionally, set the <code>JAVA_HOME</code> environment variable
  110. (see the <a href="#advanced">Advanced</a> section below).
  111. This should be set to the directory where your JDK is installed.</li>
  112. </ul>
  113. <p><strong>Note:</strong> Do not install Ant's ant.jar file into the lib/ext
  114. directory of the JDK/JRE. Ant is an application, whilst the extension
  115. directory is intended for JDK extensions. In particular there are security
  116. restrictions on the classes which may be loaded by an extension.</p>
  117. <h3><a name="optionalTasks">Optional Tasks</a></h3>
  118. <p>Ant supports a number of optional tasks. An optional task is a task which
  119. typically requires an external library to function. The optional tasks are
  120. packaged together with the core Ant tasks.</p>
  121. <p>The external libraries required by each of the optional tasks is detailed
  122. in the <a href="#librarydependencies">Library Dependencies</a> section. These external
  123. libraries may either be placed in Ant's lib directory, where they will be picked up
  124. automatically, or made available on the system CLASSPATH environment variable.
  125. </p>
  126. <h3>Windows</h3>
  127. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  128. environment:</p>
  129. <pre>set ANT_HOME=c:\ant
  130. set JAVA_HOME=c:\jdk1.2.2
  131. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  132. <h3>Unix (bash)</h3>
  133. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  134. the environment:</p>
  135. <pre>export ANT_HOME=/usr/local/ant
  136. export JAVA_HOME=/usr/local/jdk-1.2.2
  137. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  138. <h3>Unix (csh)</h3>
  139. <pre>setenv ANT_HOME /usr/local/ant
  140. setenv JAVA_HOME /usr/local/jdk-1.2.2
  141. set path=( $path $ANT_HOME/bin )</pre>
  142. <h3><a name="advanced">Advanced</a></h3>
  143. <p>There are lots of variants that can be used to run Ant. What you need is at
  144. least the following:</p>
  145. <ul>
  146. <li>The classpath for Ant must contain <code>ant.jar</code> and any jars/classes
  147. needed for your chosen JAXP-compliant XML parser.</li>
  148. <li>When you need JDK functionality
  149. (such as for the <a href="CoreTasks/javac.html">javac</a> task or the
  150. <a href="CoreTasks/rmic.html">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  151. file of the JDK must be added to the classpath; for JDK 1.2 or JDK 1.3, <code>tools.jar</code>
  152. must be added. The scripts supplied with Ant,
  153. in the <code>bin</code> directory, will add
  154. the required JDK classes automatically, if the <code>JAVA_HOME</code>
  155. environment variable is set.</li>
  156. <li>When you are executing platform-specific applications, such as the
  157. <a href="CoreTasks/exec.html">exec</a> task or the
  158. <a href="CoreTasks/cvs.html">cvs</a> task, the property <code>ant.home</code>
  159. must be set to the directory containing where you installed Ant. Again
  160. this is set by the Ant scripts to the value of the ANT_HOME environment
  161. variable.</li>
  162. </ul>
  163. The supplied ant shell scripts all support an <tt>ANT_OPTS</tt>
  164. environment variable which can be used to supply extra options
  165. to ant. Some of the scripts also read in an extra script stored
  166. in the users home directory, which can be used to set such options. Look
  167. at the source for your platform's invocation script for details.
  168. <hr>
  169. <h2><a name="buildingant">Building Ant</a></h2>
  170. <p>To build Ant from source, you can either install the Ant source distribution
  171. or checkout the jakarta-ant module from CVS.</p>
  172. <p>Once you have installed the source, change into the installation
  173. directory.</p>
  174. <p>Set the <code>JAVA_HOME</code> environment variable
  175. to the directory where the JDK is installed.
  176. See <a href="#installing">Installing Ant</a>
  177. for examples on how to do this for your operating system. </p>
  178. <p>Make sure you have downloaded any auxiliary jars required to
  179. build tasks you are interested in. These should either be available
  180. on the CLASSPATH or added to the <code>lib</code>
  181. directory.
  182. See <a href="#librarydependencies">Library Dependencies</a>
  183. for a list of jar requirements for various features.
  184. Note that this will make the auxiliary jars
  185. available for the building of Ant only. For running Ant you will
  186. still need to
  187. make the jars available as described under
  188. <a href="#installing">Installing Ant</a>.</p>
  189. <p>Your are now ready to build Ant:</p>
  190. <blockquote>
  191. <p><code>build -Ddist.dir=&lt;<i>directory_to_contain_Ant_distribution</i>&gt; dist</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  192. <p><code>build.sh -Ddist.dir=&lt;<i>directory_to_contain_Ant_distribution</i>&gt; dist</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  193. </blockquote>
  194. <p>This will create a binary distribution of Ant in the directory you specified.</p>
  195. <p>The above action does the following:</p>
  196. <ul>
  197. <li>If necessary it will bootstrap the Ant code. Bootstrapping involves the manual
  198. compilation of enough Ant code to be able to run Ant. The bootstrapped Ant is
  199. used for the remainder of the build steps. </li>
  200. <li>Invokes the bootstrapped Ant with the parameters passed to the build script. In
  201. this case, these parameters define an Ant property value and specify the &quot;dist&quot; target
  202. in Ant's own <code>build.xml</code> file.</li>
  203. </ul>
  204. <p>On most occasions you will not need to explicitly bootstrap Ant since the build
  205. scripts do that for you. If however, the build file you are using makes use of features
  206. not yet compiled into the bootstrapped Ant, you will need to manually bootstrap.
  207. Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  208. to build a new bootstrap version of Ant.</p>
  209. If you wish to install the build into the current <code>ANT_HOME</code>
  210. directory, you can use:
  211. <blockquote>
  212. <p><code>build install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  213. <p><code>build.sh install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  214. </blockquote>
  215. You can avoid the lengthy Javadoc step, if desired, with:
  216. <blockquote>
  217. <p><code>build install-lite</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  218. <p><code>build.sh install-lite</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  219. </blockquote>
  220. This will only install the <code>bin</code> and <code>lib</code> directories.
  221. <p>Both the <code>install</code> and
  222. <code>install-lite</code> targets will overwrite
  223. the current Ant version in <code>ANT_HOME</code>.</p>
  224. <hr>
  225. <h2><a name="librarydependencies">Library Dependencies</a></h2>
  226. <p>The following libraries are needed in your CLASSPATH or in the
  227. install directory's <code>lib</code> directory if you are using the
  228. indicated feature. Note that only one of the regexp libraries is
  229. needed for use with the mappers. You will also need to install the
  230. Ant optional jar containing the task definitions to make these
  231. tasks available. Please refer to the <a href="#optionalTasks">
  232. Installing Ant / Optional Tasks</a> section above.</p>
  233. <table border="1" cellpadding="2" cellspacing="0">
  234. <tr>
  235. <td><b>Jar Name</b></td>
  236. <td><b>Needed For</b></td>
  237. <td><b>Available At</b></td>
  238. </tr>
  239. <tr>
  240. <td>An XSL transformer like Xalan or XSL:P</td>
  241. <td>style task</td>
  242. <td><a href="http://xml.apache.org/xalan-j/index.html"
  243. target="_top">http://xml.apache.org/xalan-j/index.html</a> for Xalan.<br>
  244. XSL:P used to live at <a href="http://www.clc-marketing.com/xslp/"
  245. target="_top">http://www.clc-marketing.com/xslp/</a>, but the link
  246. doesn't work any longer and we are not aware of a replacement site.</td>
  247. </tr>
  248. <tr>
  249. <td>jakarta-regexp-1.2.jar</td>
  250. <td>regexp type with mappers</td>
  251. <td><a href="http://jakarta.apache.org/regexp/" target="_top">jakarta.apache.org/regexp/</a></td>
  252. </tr>
  253. <tr>
  254. <td>jakarta-oro-2.0.6.jar</td>
  255. <td>regexp type with mappers and the perforce tasks</td>
  256. <td><a href="http://jakarta.apache.org/oro/" target="_top">jakarta.apache.org/oro/</a></td>
  257. </tr>
  258. <tr>
  259. <td>junit.jar</td>
  260. <td>junit tasks</td>
  261. <td><a href="http://www.junit.org/" target="_top">www.junit.org</a></td>
  262. </tr>
  263. <tr>
  264. <td>xalan.jar</td>
  265. <td>junitreport task</td>
  266. <td><a href="http://xml.apache.org/" target="_top">xml.apache.org</a></td>
  267. </tr>
  268. <tr>
  269. <td>stylebook.jar</td>
  270. <td>stylebook task</td>
  271. <td>CVS repository of <a href="http://xml.apache.org" target="_top">xml.apache.org</a></td>
  272. </tr>
  273. <tr>
  274. <td>testlet.jar</td>
  275. <td>test task</td>
  276. <td><a href="http://java.apache.org/framework" target="_top">java.apache.org/framework</a></td>
  277. </tr>
  278. <tr>
  279. <td>antlr.jar</td>
  280. <td>antlr task</td>
  281. <td><a href="http://www.antlr.org/" target="_top">www.antlr.org</a></td>
  282. </tr>
  283. <tr>
  284. <td >bsf.jar</td>
  285. <td>script task</td>
  286. <td><a href="http://jakarta.apache.org/bsf/" target="_top">http://jakarta.apache.org/bsf/</a></td>
  287. </tr>
  288. <tr>
  289. <td>netrexx.jar</td>
  290. <td>netrexx task, Rexx with the script task</td>
  291. <td><a href="http://www2.hursley.ibm.com/netrexx" target="_top">
  292. www2.hursley.ibm.com/netrexx</a></td>
  293. </tr>
  294. <tr>
  295. <td>js.jar</td>
  296. <td>Javascript with script task</td>
  297. <td><a href="http://www.mozilla.org/rhino/" target="_top">www.mozilla.org/rhino</a></td>
  298. </tr>
  299. <tr>
  300. <td>jython.jar</td>
  301. <td>Python with script task</td>
  302. <td><a href="http://jython.sourceforge.net/" target="_top">jython.sourceforge.net</a></td>
  303. </tr>
  304. <tr>
  305. <td>jpython.jar</td>
  306. <td>Python with script task <b>deprecated, jython is the prefered engine</b></td>
  307. <td><a href="http://www.jpython.org/" target="_top">www.jpython.org</a></td>
  308. </tr>
  309. <tr>
  310. <td>jacl.jar and tcljava.jar</td>
  311. <td>TCL with script task</td>
  312. <td><a href="http://www.scriptics.com/java" target="_top">www.scriptics.com/java</a></td>
  313. </tr>
  314. <tr>
  315. <td>BeanShell JAR(s)</td>
  316. <td>BeanShell with script task</td>
  317. <td><a href="http://www.beanshell.org" target="_top">www.beanshell.org</a></td>
  318. </tr>
  319. <tr>
  320. <td>jruby.jar</td>
  321. <td>Ruby with script task</td>
  322. <td><a href="http://jruby.sourceforge.net/" target="_top">jruby.sourceforge.net</a></td>
  323. </tr>
  324. <tr>
  325. <td>judo.jar</td>
  326. <td>Judoscript with script task</td>
  327. <td><a href="http://www.judoscript.com/index.html" target="_top">www.judoscript.com/index.html</a></td>
  328. </tr>
  329. <tr>
  330. <td>netcomponents.jar</td>
  331. <td>ftp and telnet tasks</td>
  332. <td><a href="http://www.savarese.org/oro/downloads/index.html#NetComponents"
  333. target="_top">www.savarese.org/oro/downloads</a></td>
  334. </tr>
  335. <tr>
  336. <td>bcel.jar</td>
  337. <td>classfileset data type,
  338. JavaClassHelper used by the ClassConstants filter reader and
  339. optionally used by ejbjar for dependency determination
  340. </td>
  341. <td><a href="http://jakarta.apache.org/bcel/" target="_top">jakarta.apache.org/bcel/</a></td>
  342. </tr>
  343. <tr>
  344. <td>mail.jar</td>
  345. <td>Mail task with Mime encoding, and the MimeMail task</td>
  346. <td><a href="http://java.sun.com/products/javamail/"
  347. target="_top">http://java.sun.com/products/javamail/</a></td>
  348. </tr>
  349. <tr>
  350. <td>activation.jar</td>
  351. <td>Mail task with Mime encoding, and the MimeMail task</td>
  352. <td><a href="http://java.sun.com/products/javabeans/glasgow/jaf.html"
  353. target="_top">http://java.sun.com/products/javabeans/glasgow/jaf.html</a></td>
  354. </tr>
  355. <tr>
  356. <td>jdepend.jar</td>
  357. <td>jdepend task</td>
  358. <td><a href="http://www.clarkware.com/software/JDepend.html"
  359. target="_top">http://www.clarkware.com/software/JDepend.html</a></td>
  360. </tr>
  361. <tr>
  362. <td>resolver.jar <b>after the 1.0 release</b></td>
  363. <td>xmlcatalog datatype <em>only if support for external catalog files is desired</em></td>
  364. <td><a href="http://xml.apache.org/dist/commons/"
  365. target="_top">http://xml.apache.org/dist/commons</a> for released
  366. versions, <a
  367. href="http://gump.covalent.net/jars/latest/xml-commons/"
  368. target="_top">http://gump.covalent.net/jars/latest/xml-commons/</a>
  369. for a nightly snapshot.</td>
  370. </tr>
  371. </table>
  372. <br>
  373. <hr>
  374. <p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
  375. Reserved.</p>
  376. </body>
  377. </html>