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 13 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Apache Ant User Manual</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 can be downloaded from <a
  11. href="http://jakarta.apache.org/builds/ant/release/v1.4.1/bin/">
  12. http://jakarta.apache.org/builds/ant/release/v1.4.1/bin/</a>.
  13. If you like living on the edge, you can download the latest version from <a
  14. href="http://jakarta.apache.org/builds/ant/nightly/">http://jakarta.apache.org/builds/ant/nightly/</a>.</p>
  15. <h3>Source Edition</h3>
  16. <p>If you prefer the source edition, you can download the source for the latest Ant release from <a
  17. href="http://jakarta.apache.org/builds/ant/release/v1.4.1/src/">
  18. http://jakarta.apache.org/builds/ant/release/v1.4.1/src/</a>.
  19. Again, if you prefer the edge, you can access
  20. the code as it is being developed via CVS. The Jakarta website has details on
  21. <a href="http://jakarta.apache.org/site/cvsindex.html" target="_top">accessing CVS</a>. Please checkout the
  22. jakarta-ant module.
  23. See the section <a href="#buildingant">Building Ant</a> on how to
  24. build Ant from the source code.
  25. You can also access the
  26. <a href="http://cvs.apache.org/viewcvs/jakarta-ant/" target="_top">
  27. Ant CVS repository</a> on-line. </p>
  28. <hr>
  29. <h2><a name="sysrequirements">System Requirements</a></h2>
  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/crimson/index.html">Apache Crimson</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>jaxp.jar</code> and <code>crimson.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. A future version of Ant will require
  47. JDK 1.2 or later.
  48. </p>
  49. <hr>
  50. <h2><a name="installing">Installing Ant</a></h2>
  51. <p>The binary distribution of Ant consists of three directories:
  52. <code>bin</code>,
  53. <code>docs</code> and
  54. <code>lib</code>
  55. Only the <code>bin</code> and <code>lib</code> directories are
  56. required to run Ant.
  57. To install Ant, choose a directory and copy the distribution
  58. file there. This directory will be known as ANT_HOME.
  59. </p>
  60. <table width="80%">
  61. <tr>
  62. <td colspan="2">
  63. <b>Windows 95 and Windows 98 Note:</b>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td width="5%">&nbsp;</td>
  68. <td><i>
  69. On these systems, the script used to launch Ant will have
  70. problems if ANT_HOME is a long filename. This is due to
  71. limitations in the OS's handling of the <code>&quot;for&quot;</code>
  72. batch-file statement. It is recommended, therefore, that Ant be
  73. installed in a <b>short</b> path, such as C:\Ant.</i>
  74. </td>
  75. </tr>
  76. </table>
  77. <p>
  78. Before you can run ant there is some additional set up you
  79. will need to do:</p>
  80. <ul>
  81. <li>Add the <code>bin</code> directory to your path.</li>
  82. <li>Set the <code>ANT_HOME</code> environment variable to the
  83. directory where you installed Ant. On some operating systems the ant
  84. wrapper scripts can guess <code>ANT_HOME</code> (Unix dialects and
  85. Windows NT/2000) - but it is better to not rely on this behavior.</li>
  86. <li>Optionally, set the <code>JAVA_HOME</code> environment variable
  87. (see the <a href="#advanced">Advanced</a> section below).
  88. This should be set to the directory where your JDK is installed.</li>
  89. </ul>
  90. <p><strong>Note:</strong> Do not install Ant's ant.jar file into the lib/ext
  91. directory of the JDK/JRE. Ant is an application, whilst the extension
  92. directory is intended for JDK extensions. In particular there are security
  93. restrictions on the classes which may be loaded by an extension.</p>
  94. <h3><a name="optionalTasks">Optional Tasks</a></h3>
  95. <p>Ant supports a number of optional tasks. An optional task is a task which
  96. typically requires an external library to function. The optional tasks are
  97. packaged separately from the core Ant tasks. This package is available in
  98. the same download directory as the core ant distribution. The current
  99. jar containing optional tasks is named <code>jakarta-ant-1.4.1-optional.jar</code>.
  100. This jar should be downloaded and placed in the lib directory of your Ant
  101. installation.</p>
  102. <p>The external libraries required by each of the optional tasks is detailed
  103. in the <a href="#librarydependencies">Library Dependencies</a> section. These external
  104. libraries may either be placed in Ant's lib directory, where they will be picked up
  105. automatically, or made available on the system CLASSPATH environment variable.
  106. </p>
  107. <h3>Windows</h3>
  108. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  109. environment:</p>
  110. <pre>set ANT_HOME=c:\ant
  111. set JAVA_HOME=c:\jdk1.2.2
  112. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  113. <h3>Unix (bash)</h3>
  114. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  115. the environment:</p>
  116. <pre>export ANT_HOME=/usr/local/ant
  117. export JAVA_HOME=/usr/local/jdk-1.2.2
  118. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  119. <h3>Unix (csh)</h3>
  120. <pre>setenv ANT_HOME /usr/local/ant
  121. setenv JAVA_HOME /usr/local/jdk-1.2.2
  122. set path=( $path $ANT_HOME/bin )</pre>
  123. <h3><a name="advanced">Advanced</a></h3>
  124. <p>There are lots of variants that can be used to run Ant. What you need is at
  125. least the following:</p>
  126. <ul>
  127. <li>The classpath for Ant must contain <code>ant.jar</code> and any jars/classes
  128. needed for your chosen JAXP-compliant XML parser.</li>
  129. <li>When you need JDK functionality
  130. (such as for the <a href="CoreTasks/javac.html">javac</a> task or the
  131. <a href="CoreTasks/rmic.html">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  132. file of the JDK must be added to the classpath; for JDK 1.2 or JDK 1.3, <code>tools.jar</code>
  133. must be added. The scripts supplied with Ant,
  134. in the <code>bin</code> directory, will add
  135. the required JDK classes automatically, if the <code>JAVA_HOME</code>
  136. environment variable is set.</li>
  137. <li>When you are executing platform-specific applications, such as the
  138. <a href="CoreTasks/exec.html">exec</a> task or the
  139. <a href="CoreTasks/cvs.html">cvs</a> task, the property <code>ant.home</code>
  140. must be set to the directory containing where you installed Ant. Again
  141. this is set by the Ant scripts to the value of the ANT_HOME environment
  142. variable.</li>
  143. </ul>
  144. <hr>
  145. <h2><a name="buildingant">Building Ant</a></h2>
  146. <p>To build Ant from source, you can either install the Ant source distribution
  147. or checkout the jakarta-ant module from CVS.</p>
  148. <p>Once you have installed the source, change into the installation
  149. directory.</p>
  150. <p>Set the <code>JAVA_HOME</code> environment variable
  151. to the directory where the JDK is installed.
  152. See <a href="#installing">Installing Ant</a>
  153. for examples on how to do this for your operating system. </p>
  154. <p>Make sure you have downloaded any auxiliary jars required to
  155. build tasks you are interested in. These should either be available
  156. on the CLASSPATH or added to the <code>lib/optional</code>
  157. directory.
  158. See <a href="#librarydependencies">Library Dependencies</a>
  159. for a list of jar requirements for various features.
  160. Note that this will make the auxiliary jars
  161. available for the building of Ant only. For running Ant you will
  162. still need to
  163. make the jars available as described under
  164. <a href="#installing">Installing Ant</a>.</p>
  165. <p>Your are now ready to build Ant:</p>
  166. <blockquote>
  167. <p><code>build -Ddist.dir=&lt;<i>directory_to_contain_Ant_distribution</i>&gt; dist</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  168. <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>
  169. </blockquote>
  170. <p>This will create a binary distribution of Ant in the directory you specified.</p>
  171. <p>The above action does the following:</p>
  172. <ul>
  173. <li>If necessary it will bootstrap the Ant code. Bootstrapping involves the manual
  174. compilation of enough Ant code to be able to run Ant. The bootstrapped Ant is
  175. used for the remainder of the build steps. </li>
  176. <li>Invokes the bootstrapped Ant with the parameters passed to the build script. In
  177. this case, these parameters define an Ant property value and specify the &quot;dist&quot; target
  178. in Ant's own <code>build.xml</code> file.</li>
  179. </ul>
  180. <p>On most occasions you will not need to explicitly bootstrap Ant since the build
  181. scripts do that for you. If however, the build file you are using makes use of features
  182. not yet compiled into the bootstrapped Ant, you will need to manually bootstrap.
  183. Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  184. to build a new bootstrap version of Ant.</p>
  185. If you wish to install the build into the current <code>ANT_HOME</code>
  186. directory, you can use:
  187. <blockquote>
  188. <p><code>build install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  189. <p><code>build.sh install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  190. </blockquote>
  191. You can avoid the lengthy Javadoc step, if desired, with:
  192. <blockquote>
  193. <p><code>build install-lite</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  194. <p><code>build.sh install-lite</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  195. </blockquote>
  196. This will only install the <code>bin</code> and <code>lib</code> directories.
  197. <p>Both the <code>install</code> and
  198. <code>install-lite</code> targets will overwrite
  199. the current Ant version in <code>ANT_HOME</code>.</p>
  200. <hr>
  201. <h2><a name="librarydependencies">Library Dependencies</a></h2>
  202. <p>The following libraries are needed in your CLASSPATH or in the
  203. install directory's <code>lib</code> directory if you are using the
  204. indicated feature. Note that only one of the regexp libraries is
  205. needed for use with the mappers. You will also need to install the
  206. Ant optional jar containing the task definitions to make these
  207. tasks available. Please refer to the <a href="#optionalTasks">
  208. Installing Ant / Optional Tasks</a> section above.</p>
  209. <table border="1" cellpadding="2" cellspacing="0">
  210. <tr>
  211. <td><b>Jar Name</b></td>
  212. <td><b>Needed For</b></td>
  213. <td><b>Available At</b></td>
  214. </tr>
  215. <tr>
  216. <td>An XSL transformer like Xalan, Adaptx or XSL:P</td>
  217. <td>style task</td>
  218. <td><a href="http://xml.apache.org/xalan-j/index.html"
  219. target="_top">http://xml.apache.org/xalan-j/index.html</a>,
  220. CVS module adaptx from :pserver:anoncvs@virtuals.intalio.com:/cvs/adaptx
  221. with password anoncvs
  222. or <a href="http://www.clc-marketing.com/xslp/"
  223. target="_top">http://www.clc-marketing.com/xslp/</a></td>
  224. </tr>
  225. <tr>
  226. <td>jakarta-regexp-1.2.jar</td>
  227. <td>regexp type with mappers</td>
  228. <td><a href="http://jakarta.apache.org/regexp/" target="_top">jakarta.apache.org/regexp/</a></td>
  229. </tr>
  230. <tr>
  231. <td>jakarta-oro-2.0.4.jar</td>
  232. <td>regexp type with mappers and the perforce tasks</td>
  233. <td><a href="http://jakarta.apache.org/oro/" target="_top">jakarta.apache.org/oro/</a></td>
  234. </tr>
  235. <tr>
  236. <td>junit.jar</td>
  237. <td>junit tasks</td>
  238. <td><a href="http://www.junit.org/" target="_top">www.junit.org</a></td>
  239. </tr>
  240. <tr>
  241. <td>stylebook.jar</td>
  242. <td>stylebook task</td>
  243. <td>CVS repository of <a href="http://xml.apache.org" target="_top">xml.apache.org</a></td>
  244. </tr>
  245. <tr>
  246. <td>testlet.jar</td>
  247. <td>test task</td>
  248. <td><a href="http://java.apache.org/framework" target="_top">java.apache.org/framework</a></td>
  249. </tr>
  250. <tr>
  251. <td>antlr.jar</td>
  252. <td>antlr task</td>
  253. <td><a href="http://www.antlr.org/" target="_top">www.antlr.org</a></td>
  254. </tr>
  255. <tr>
  256. <td >bsf.jar</td>
  257. <td>script task</td>
  258. <td><a href="http://oss.software.ibm.com/developerworks/projects/bsf" target="_top">
  259. oss.software.ibm.com/developerworks/projects/bsf</a></td>
  260. </tr>
  261. <tr>
  262. <td>netrexx.jar</td>
  263. <td>netrexx task</td>
  264. <td><a href="http://www2.hursley.ibm.com/netrexx" target="_top">
  265. www2.hursley.ibm.com/netrexx</a></td>
  266. </tr>
  267. <tr>
  268. <td>rhino.jar</td>
  269. <td>javascript with script task</td>
  270. <td><a href="http://www.mozilla.org/rhino/" target="_top">www.mozilla.org/rhino</a></td>
  271. </tr>
  272. <tr>
  273. <td>jpython.jar</td>
  274. <td>python with script task</td>
  275. <td><a href="http://www.jpython.org/" target="_top">www.jpython.org</a></td>
  276. </tr>
  277. <tr>
  278. <td>netcomponents.jar</td>
  279. <td>ftp and telnet tasks</td>
  280. <td><a href="http://www.savarese.org/oro/downloads/index.html#NetComponents"
  281. target="_top">www.savarese.org/oro/downloads</a></td>
  282. </tr>
  283. </table>
  284. <br>
  285. <hr>
  286. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  287. Reserved.</p>
  288. </body>
  289. </html>