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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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/ant/nightly/">http://cvs.apache.org/builds/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. 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/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, OS/2 Warp, 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.2 or later.
  47. </p><p>
  48. <strong>Note: </strong>The Microsoft JVM/JDK is not supported.
  49. </p>
  50. <p>
  51. <strong>Note #2: </strong>If a JDK is not present, only the JRE runtime, then many tasks will not work.
  52. </p>
  53. <hr>
  54. <h2><a name="installing">Installing Ant</a></h2>
  55. <p>The binary distribution of Ant consists of the following directory layout:
  56. <pre>
  57. ant
  58. +--- bin // contains launcher scripts
  59. |
  60. +--- lib // contains Ant jars plus necessary dependencies
  61. |
  62. +--- docs // contains documentation
  63. | +--- ant2 // a brief description of ant2 requirements
  64. | |
  65. | +--- images // various logos for html documentation
  66. | |
  67. | +--- manual // Ant documentation (a must read ;-)
  68. |
  69. +--- etc // contains xsl goodies to:
  70. // - create an enhanced report from xml output of various tasks.
  71. // - migrate your build files and get rid of 'deprecated' warning
  72. // - ... and more ;-)
  73. </pre>
  74. Only the <code>bin</code> and <code>lib</code> directories are
  75. required to run Ant.
  76. To install Ant, choose a directory and copy the distribution
  77. file there. This directory will be known as ANT_HOME.
  78. </p>
  79. <table width="80%">
  80. <tr>
  81. <td colspan="2">
  82. <b>Windows 95, Windows 98 &amp; Windows ME Note:</b>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td width="5%">&nbsp;</td>
  87. <td><i>
  88. On these systems, the script used to launch Ant will have
  89. problems if ANT_HOME is a long filename (i.e. a filename which is not
  90. of the format known as &quot;8.3&quot;). This is due to
  91. limitations in the OS's handling of the <code>&quot;for&quot;</code>
  92. batch-file statement. It is recommended, therefore, that Ant be
  93. installed in a <b>short</b>, 8.3 path, such as C:\Ant. </i>
  94. </td>
  95. </tr>
  96. <tr>
  97. <td width="5%">&nbsp;</td>
  98. <td>
  99. <p>On these systems you will also need to configure more environment
  100. space to cater for the environment variables used in the Ant lauch script.
  101. To do this, you will need to add or update the following line in
  102. the <code>config.sys</code> file
  103. </p>
  104. <p><code>shell=c:\command.com c:\ /p /e:32768</code></p>
  105. </td>
  106. </tr>
  107. </table>
  108. <h3>Setup</h3>
  109. <p>
  110. Before you can run ant there is some additional set up you
  111. will need to do:</p>
  112. <ul>
  113. <li>Add the <code>bin</code> directory to your path.</li>
  114. <li>Set the <code>ANT_HOME</code> environment variable to the
  115. directory where you installed Ant. On some operating systems the ant
  116. wrapper scripts can guess <code>ANT_HOME</code> (Unix dialects and
  117. Windows NT/2000) - but it is better to not rely on this behavior.</li>
  118. <li>Optionally, set the <code>JAVA_HOME</code> environment variable
  119. (see the <a href="#advanced">Advanced</a> section below).
  120. This should be set to the directory where your JDK is installed.</li>
  121. </ul>
  122. <p><strong>Note:</strong> Do not install Ant's ant.jar file into the lib/ext
  123. directory of the JDK/JRE. Ant is an application, whilst the extension
  124. directory is intended for JDK extensions. In particular there are security
  125. restrictions on the classes which may be loaded by an extension.</p>
  126. <h3><a name="optionalTasks">Optional Tasks</a></h3>
  127. <p>Ant supports a number of optional tasks. An optional task is a task which
  128. typically requires an external library to function. The optional tasks are
  129. packaged together with the core Ant tasks.</p>
  130. <p>The external libraries required by each of the optional tasks is detailed
  131. in the <a href="#librarydependencies">Library Dependencies</a> section. These external
  132. libraries may either be placed in Ant's lib directory, where they will be picked up
  133. automatically, or made available on the system CLASSPATH environment variable.
  134. </p>
  135. <h3>Windows and OS/2</h3>
  136. <p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
  137. environment:</p>
  138. <pre>set ANT_HOME=c:\ant
  139. set JAVA_HOME=c:\jdk1.2.2
  140. set PATH=%PATH%;%ANT_HOME%\bin</pre>
  141. <h3>Unix (bash)</h3>
  142. <p>Assume Ant is installed in <code>/usr/local/ant</code>. The following sets up
  143. the environment:</p>
  144. <pre>export ANT_HOME=/usr/local/ant
  145. export JAVA_HOME=/usr/local/jdk-1.2.2
  146. export PATH=${PATH}:${ANT_HOME}/bin</pre>
  147. <h3>Unix (csh)</h3>
  148. <pre>setenv ANT_HOME /usr/local/ant
  149. setenv JAVA_HOME /usr/local/jdk-1.2.2
  150. set path=( $path $ANT_HOME/bin )</pre>
  151. <h3><a name="advanced">Advanced</a></h3>
  152. <p>There are lots of variants that can be used to run Ant. What you need is at
  153. least the following:</p>
  154. <ul>
  155. <li>The classpath for Ant must contain <code>ant.jar</code> and any jars/classes
  156. needed for your chosen JAXP-compliant XML parser.</li>
  157. <li>When you need JDK functionality
  158. (such as for the <a href="CoreTasks/javac.html">javac</a> task or the
  159. <a href="CoreTasks/rmic.html">rmic</a> task), then for JDK 1.1, the <code>classes.zip</code>
  160. file of the JDK must be added to the classpath; for JDK 1.2 or JDK 1.3, <code>tools.jar</code>
  161. must be added. The scripts supplied with Ant,
  162. in the <code>bin</code> directory, will add
  163. the required JDK classes automatically, if the <code>JAVA_HOME</code>
  164. environment variable is set.</li>
  165. <li>When you are executing platform-specific applications, such as the
  166. <a href="CoreTasks/exec.html">exec</a> task or the
  167. <a href="CoreTasks/cvs.html">cvs</a> task, the property <code>ant.home</code>
  168. must be set to the directory containing where you installed Ant. Again
  169. this is set by the Ant scripts to the value of the ANT_HOME environment
  170. variable.</li>
  171. </ul>
  172. The supplied ant shell scripts all support an <tt>ANT_OPTS</tt>
  173. environment variable which can be used to supply extra options
  174. to ant. Some of the scripts also read in an extra script stored
  175. in the users home directory, which can be used to set such options. Look
  176. at the source for your platform's invocation script for details.
  177. <hr>
  178. <h2><a name="buildingant">Building Ant</a></h2>
  179. <p>To build Ant from source, you can either install the Ant source distribution
  180. or checkout the ant module from CVS.</p>
  181. <p>Once you have installed the source, change into the installation
  182. directory.</p>
  183. <p>Set the <code>JAVA_HOME</code> environment variable
  184. to the directory where the JDK is installed.
  185. See <a href="#installing">Installing Ant</a>
  186. for examples on how to do this for your operating system. </p>
  187. <p>Make sure you have downloaded any auxiliary jars required to
  188. build tasks you are interested in. These should either be available
  189. on the CLASSPATH or added to the <code>lib</code>
  190. directory.
  191. See <a href="#librarydependencies">Library Dependencies</a>
  192. for a list of jar requirements for various features.
  193. Note that this will make the auxiliary jars
  194. available for the building of Ant only. For running Ant you will
  195. still need to
  196. make the jars available as described under
  197. <a href="#installing">Installing Ant</a>.</p>
  198. <p>Your are now ready to build Ant:</p>
  199. <blockquote>
  200. <p><code>build -Ddist.dir=&lt;<i>directory_to_contain_Ant_distribution</i>&gt; dist</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  201. <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>
  202. </blockquote>
  203. <p>This will create a binary distribution of Ant in the directory you specified.</p>
  204. <p>The above action does the following:</p>
  205. <ul>
  206. <li>If necessary it will bootstrap the Ant code. Bootstrapping involves the manual
  207. compilation of enough Ant code to be able to run Ant. The bootstrapped Ant is
  208. used for the remainder of the build steps. </li>
  209. <li>Invokes the bootstrapped Ant with the parameters passed to the build script. In
  210. this case, these parameters define an Ant property value and specify the &quot;dist&quot; target
  211. in Ant's own <code>build.xml</code> file.</li>
  212. </ul>
  213. <p>On most occasions you will not need to explicitly bootstrap Ant since the build
  214. scripts do that for you. If however, the build file you are using makes use of features
  215. not yet compiled into the bootstrapped Ant, you will need to manually bootstrap.
  216. Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
  217. to build a new bootstrap version of Ant.</p>
  218. If you wish to install the build into the current <code>ANT_HOME</code>
  219. directory, you can use:
  220. <blockquote>
  221. <p><code>build install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  222. <p><code>build.sh install</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  223. </blockquote>
  224. You can avoid the lengthy Javadoc step, if desired, with:
  225. <blockquote>
  226. <p><code>build install-lite</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Windows</i>)</p>
  227. <p><code>build.sh install-lite</code>&nbsp;&nbsp;&nbsp;&nbsp;(<i>Unix</i>)</p>
  228. </blockquote>
  229. This will only install the <code>bin</code> and <code>lib</code> directories.
  230. <p>Both the <code>install</code> and
  231. <code>install-lite</code> targets will overwrite
  232. the current Ant version in <code>ANT_HOME</code>.</p>
  233. <hr>
  234. <h2><a name="librarydependencies">Library Dependencies</a></h2>
  235. <p>The following libraries are needed in your CLASSPATH or in the
  236. install directory's <code>lib</code> directory if you are using the
  237. indicated feature. Note that only one of the regexp libraries is
  238. needed for use with the mappers
  239. (and Java 1.4 and higher includes a regexp implementation which
  240. Ant will find automatically).
  241. You will also need to install the
  242. Ant optional jar containing the task definitions to make these
  243. tasks available. Please refer to the <a href="#optionalTasks">
  244. Installing Ant / Optional Tasks</a> section above.</p>
  245. <table border="1" cellpadding="2" cellspacing="0">
  246. <tr>
  247. <td><b>Jar Name</b></td>
  248. <td><b>Needed For</b></td>
  249. <td><b>Available At</b></td>
  250. </tr>
  251. <tr>
  252. <td>An XSL transformer like Xalan or XSL:P</td>
  253. <td>style task</td>
  254. <td>
  255. <b>If you use JDK 1.4, an XSL transformer is already included, so you need not do anything special.</b><br>
  256. <ul><li>XALAN : <a href="http://xml.apache.org/xalan-j/index.html"
  257. target="_top">http://xml.apache.org/xalan-j/index.html</a></li>
  258. <li>XSL:P : used to live at <a href="http://www.clc-marketing.com/xslp/"
  259. target="_top">http://www.clc-marketing.com/xslp/</a>, but the link
  260. doesn't work any longer and we are not aware of a replacement site.</li></ul>
  261. </td>
  262. </tr>
  263. <tr>
  264. <td>jakarta-regexp-1.3.jar</td>
  265. <td>regexp type with mappers</td>
  266. <td><a href="http://jakarta.apache.org/regexp/" target="_top">http://jakarta.apache.org/regexp/</a></td>
  267. </tr>
  268. <tr>
  269. <td>jakarta-oro-2.0.7.jar</td>
  270. <td>regexp type with mappers and the perforce tasks</td>
  271. <td><a href="http://jakarta.apache.org/oro/" target="_top">http://jakarta.apache.org/oro/</a></td>
  272. </tr>
  273. <tr>
  274. <td>junit.jar</td>
  275. <td>junit tasks</td>
  276. <td><a href="http://www.junit.org/" target="_top">http://www.junit.org/</a></td>
  277. </tr>
  278. <tr>
  279. <td>xalan.jar</td>
  280. <td>junitreport task</td>
  281. <td><a href="http://xml.apache.org/xalan-j/" target="_top">http://xml.apache.org/xalan-j/</a></td>
  282. </tr>
  283. <tr>
  284. <td>stylebook.jar</td>
  285. <td>stylebook task</td>
  286. <td>CVS repository of <a href="http://xml.apache.org/" target="_top">http://xml.apache.org/</a></td>
  287. </tr>
  288. <tr>
  289. <td>testlet.jar</td>
  290. <td><strong>deprecated</strong> test task</td>
  291. <td>Build from the gzip compress tar archive in <a
  292. href="http://avalon.apache.org/historiccvs/testlet/"
  293. target="_top">http://avalon.apache.org/historiccvs/testlet/</a></td>
  294. </tr>
  295. <tr>
  296. <td>antlr.jar</td>
  297. <td>antlr task</td>
  298. <td><a href="http://www.antlr.org/" target="_top">http://www.antlr.org/</a></td>
  299. </tr>
  300. <tr>
  301. <td >bsf.jar</td>
  302. <td>script task<br/>
  303. <strong>Note</strong>: Ant 1.6 and later require Apache BSF, not
  304. the IBM version. I.e. you need BSF 2.3.0-rc1 or later.</td>
  305. <td><a href="http://jakarta.apache.org/bsf/" target="_top">http://jakarta.apache.org/bsf/</a></td>
  306. </tr>
  307. <tr>
  308. <td>netrexx.jar</td>
  309. <td>netrexx task, Rexx with the script task</td>
  310. <td><a href="http://www2.hursley.ibm.com/netrexx/" target="_top">
  311. http://www2.hursley.ibm.com/netrexx/</a></td>
  312. </tr>
  313. <tr>
  314. <td>js.jar</td>
  315. <td>Javascript with script task<br/>
  316. If you use Apache BSF 2.3.0-rc1, you must use rhino 1.5R3 - later
  317. versions of BSF work with 1.5R4 as well.</td>
  318. <td><a href="http://www.mozilla.org/rhino/" target="_top">http://www.mozilla.org/rhino/</a></td>
  319. </tr>
  320. <tr>
  321. <td>jython.jar</td>
  322. <td>Python with script task</td>
  323. <td><a href="http://jython.sourceforge.net/" target="_top">http://jython.sourceforge.net/</a></td>
  324. </tr>
  325. <tr>
  326. <td>jpython.jar</td>
  327. <td>Python with script task <b>deprecated, jython is the prefered engine</b></td>
  328. <td><a href="http://www.jpython.org/" target="_top">http://www.jpython.org/</a></td>
  329. </tr>
  330. <tr>
  331. <td>jacl.jar and tcljava.jar</td>
  332. <td>TCL with script task</td>
  333. <td><a href="http://www.scriptics.com/software/java/" target="_top">http://www.scriptics.com/software/java/</a></td>
  334. </tr>
  335. <tr>
  336. <td>BeanShell JAR(s)</td>
  337. <td>BeanShell with script task.
  338. <br/>
  339. <strong>Note</strong>: Ant 1.6 and later require BeanShell version 1.3 or
  340. later</td>
  341. <td><a href="http://www.beanshell.org/" target="_top">http://www.beanshell.org/</a></td>
  342. </tr>
  343. <tr>
  344. <td>jruby.jar</td>
  345. <td>Ruby with script task</td>
  346. <td><a href="http://jruby.sourceforge.net/" target="_top">http://jruby.sourceforge.net/</a></td>
  347. </tr>
  348. <tr>
  349. <td>judo.jar</td>
  350. <td>Judoscript with script task</td>
  351. <td><a href="http://www.judoscript.com/index.html" target="_top">http://www.judoscript.com/index.html</a></td>
  352. </tr>
  353. <tr>
  354. <td>commons-logging.jar</td>
  355. <td>CommonsLoggingListener</td>
  356. <td><a href="http://jakarta.apache.org/commons/logging/index.html"
  357. target="_top">http://jakarta.apache.org/commons/logging/index.html</a></td>
  358. </tr>
  359. <tr>
  360. <td>log4j.jar</td>
  361. <td>Log4jListener</td>
  362. <td><a href="http://jakarta.apache.org/log4j/docs/index.html"
  363. target="_top">http://jakarta.apache.org/log4j/docs/index.html</a></td>
  364. </tr>
  365. <tr>
  366. <td>commons-net.jar</td>
  367. <td>ftp, rexec and telnet tasks</td>
  368. <td><a href="http://jakarta.apache.org/commons/net/index.html"
  369. target="_top">http://jakarta.apache.org/commons/net/index.html</a></td>
  370. </tr>
  371. <tr>
  372. <td>bcel.jar</td>
  373. <td>classfileset data type,
  374. JavaClassHelper used by the ClassConstants filter reader and
  375. optionally used by ejbjar for dependency determination
  376. </td>
  377. <td><a href="http://jakarta.apache.org/bcel/" target="_top">http://jakarta.apache.org/bcel/</a></td>
  378. </tr>
  379. <tr>
  380. <td>mail.jar</td>
  381. <td>Mail task with Mime encoding, and the MimeMail task</td>
  382. <td><a href="http://java.sun.com/products/javamail/"
  383. target="_top">http://java.sun.com/products/javamail/</a></td>
  384. </tr>
  385. <tr>
  386. <td>jsse.jar</td>
  387. <td>
  388. Support for SMTP over TLS/SSL <br/>
  389. in the Mail task<br/>
  390. Already included in jdk 1.4</td>
  391. <td><a href="http://java.sun.com/products/jsse/"
  392. target="_top">http://java.sun.com/products/jsse/</a></td>
  393. </tr>
  394. <tr>
  395. <td>activation.jar</td>
  396. <td>Mail task with Mime encoding, and the MimeMail task</td>
  397. <td><a href="http://java.sun.com/products/javabeans/glasgow/jaf.html"
  398. target="_top">http://java.sun.com/products/javabeans/glasgow/jaf.html</a></td>
  399. </tr>
  400. <tr>
  401. <td>jdepend.jar</td>
  402. <td>jdepend task</td>
  403. <td><a href="http://www.clarkware.com/software/JDepend.html"
  404. target="_top">http://www.clarkware.com/software/JDepend.html</a></td>
  405. </tr>
  406. <tr>
  407. <td>resolver.jar <b>1.1beta or later</b></td>
  408. <td>xmlcatalog datatype <em>only if support for external catalog files is desired</em></td>
  409. <td><a href="http://xml.apache.org/commons/"
  410. target="_top">http://xml.apache.org/commons/</a>.</td>
  411. </tr>
  412. <tr>
  413. <td>jsch.jar</td>
  414. <td>sshexec and scp tasks</td>
  415. <td><a href="http://www.jcraft.com/jsch/index.html"
  416. target="_top">http://www.jcraft.com/jsch/index.html</a></td>
  417. </tr>
  418. <tr>
  419. <td>JAI - Java Advanded Imaging</td>
  420. <td>image task</td>
  421. <td><a href="http://java.sun.com/products/java-media/jai/"
  422. target="_top">http://java.sun.com/products/java-media/jai/</a></td>
  423. </tr>
  424. <tr>
  425. <td>IContract</td>
  426. <td>icontract task<br/>
  427. Warning : the icontract jar file contains also antlr classes.<br/>
  428. To make the antlr task work properly, remove antlr/ANTLRGrammarParseBehavior.class
  429. from the icontract jar file installed under $ANT_HOME/lib.</td>
  430. <td><a href="http://www.reliable-systems.com/tools/"
  431. target="_top">http://www.reliable-systems.com/tools/</a></td>
  432. </tr>
  433. </table>
  434. <br>
  435. <hr>
  436. <p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
  437. Reserved.</p>
  438. </body>
  439. </html>