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

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