blob: 738adcb7b30e702c28927f5635de8856a5eb3d3c [file] [log] [blame]
Hongqing Liu71898292014-10-15 13:31:32 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 (6.0.41) - Building Tomcat</title><meta name="author" content="Remy Maucherat"><style type="text/css" media="print">
Hongqing Liufd5ee812014-05-10 16:32:51 +08002 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4 </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="./images/tomcat.gif" align="right" alt="
5 The Apache Tomcat Servlet/JSP Container
Hongqing Liu71898292014-10-15 13:31:32 +08006 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 6.0</font></h1><font face="arial,helvetica,sanserif">Version 6.0.41, May 19 2014</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.gif" align="right" alt="Apache Logo" border="0"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap="nowrap" class="noPrint"><p><strong>Links</strong></p><ul><li><a href="index.html">Docs Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li></ul><p><strong>User Guide</strong></p><ul><li><a href="introduction.html">1) Introduction</a></li><li><a href="setup.html">2) Setup</a></li><li><a href="appdev/index.html">3) First webapp</a></li><li><a href="deployer-howto.html">4) Deployer</a></li><li><a href="manager-howto.html">5) Manager</a></li><li><a href="realm-howto.html">6) Realms and AAA</a></li><li><a href="security-manager-howto.html">7) Security Manager</a></li><li><a href="jndi-resources-howto.html">8) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">9) JDBC DataSources</a></li><li><a href="class-loader-howto.html">10) Classloading</a></li><li><a href="jasper-howto.html">11) JSPs</a></li><li><a href="ssl-howto.html">12) SSL</a></li><li><a href="ssi-howto.html">13) SSI</a></li><li><a href="cgi-howto.html">14) CGI</a></li><li><a href="proxy-howto.html">15) Proxy Support</a></li><li><a href="mbeans-descriptor-howto.html">16) MBean Descriptor</a></li><li><a href="default-servlet.html">17) Default Servlet</a></li><li><a href="cluster-howto.html">18) Clustering</a></li><li><a href="balancer-howto.html">19) Load Balancer</a></li><li><a href="connectors.html">20) Connectors</a></li><li><a href="monitoring.html">21) Monitoring and Management</a></li><li><a href="logging.html">22) Logging</a></li><li><a href="apr.html">23) APR/Native</a></li><li><a href="virtual-hosting-howto.html">24) Virtual Hosting</a></li><li><a href="aio.html">25) Advanced IO</a></li><li><a href="extras.html">26) Additional Components</a></li><li><a href="maven-jars.html">27) Mavenized</a></li></ul><p><strong>Reference</strong></p><ul><li><a href="RELEASE-NOTES.txt">Release Notes</a></li><li><a href="config/index.html">Configuration</a></li><li><a href="api/index.html">Javadocs</a></li><li><a href="http://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul><p><strong>Apache Tomcat Development</strong></p><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="http://wiki.apache.org/tomcat/TomcatVersions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="funcspecs/index.html">Functional Specs.</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Apache Tomcat 6.0</h1><h2>Building Tomcat</h2><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
Hongqing Liufd5ee812014-05-10 16:32:51 +08007<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Download_a_Java_Development_Kit_(JDK)_release_(version_5)">Download a Java Development Kit (JDK) release (version 5)</a></li><li><a href="#Install_Apache_Ant_1.6.5_or_later">Install Apache Ant 1.6.5 or later</a></li><li><a href="#Checkout_or_obtain_the_source_code_for_Tomcat_6.0">Checkout or obtain the source code for Tomcat 6.0</a></li><li><a href="#Building_Tomcat">Building Tomcat</a></li><li><a href="#Building_with_Eclipse">Building with Eclipse</a></li><li><a href="#Building_with_other_IDEs">Building with other IDEs</a></li></ul>
8</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
9
10<p>
11Building Apache Tomcat from SVN is very easy, and is the first step to contributing to
12Tomcat. The following is a step by step TODO list.
13</p>
14
15</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Download a Java Development Kit (JDK) release (version 5)"><!--()--></a><a name="Download_a_Java_Development_Kit_(JDK)_release_(version_5)"><strong>Download a Java Development Kit (JDK) release (version 5)</strong></a></font></td></tr><tr><td><blockquote>
16
17<p>
18The JDK can be downloaded following the "Previous Releases" link from
19<a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">here</a>.
20</p>
21
22<p>
23<b>IMPORTANT</b>: Set an environment variable JAVA_HOME to the pathname of the
24directory into which you installed the JDK release.
25</p>
26
27</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Install Apache Ant 1.6.5 or later"><!--()--></a><a name="Install_Apache_Ant_1.6.5_or_later"><strong>Install Apache Ant 1.6.5 or later</strong></a></font></td></tr><tr><td><blockquote>
28
29<p>
30Download a binary distribution of Ant 1.6.5 or later from
31<a href="http://ant.apache.org/bindownload.cgi">here</a>.
32</p>
33
34<p>
35Unpack the binary distribution into a convenient location so that the
36Ant release resides in its own directory (conventionally named
37"apache-ant-1.6.x"). For the purposes of the remainder of this document,
38the symbolic name "${ant.home}" is used to refer to the full pathname of
39 the release directory.
40</p>
41
42<p>
43Create an ANT_HOME environment variable to point the directory ${ant.home},
44and modify the PATH environment variable to include directory
45"${ant.home}/bin" in its list. This makes the "ant" command line script
46available, which will be used to actually perform the build.
47</p>
48
49</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Checkout or obtain the source code for Tomcat 6.0"><!--()--></a><a name="Checkout_or_obtain_the_source_code_for_Tomcat_6.0"><strong>Checkout or obtain the source code for Tomcat 6.0</strong></a></font></td></tr><tr><td><blockquote>
50
51 <p>
52 Tomcat 6.0 SVN repository URL:
53 <a href="http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/">http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/</a>
54 </p>
55
56 <p>
57 Download a source package from:
58 <a href="http://tomcat.apache.org/download-60.cgi">http://tomcat.apache.org/download-60.cgi</a>
59 </p>
60
61 <p>
62 Checkout the source using SVN, selecting a tag for released version or
63 trunk for the current development code, or download and unpack a
64 source package. The location where the source has been
65 placed will be referred as <code>${tomcat.source}</code>.
66 </p>
67
68</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Building Tomcat"><!--()--></a><a name="Building_Tomcat"><strong>Building Tomcat</strong></a></font></td></tr><tr><td><blockquote>
69
70<p>
71Use the following commands:
72<code><br>
73 cd ${tomcat.source}<br>
74 ant download<br>
75 ant<br>
76</code>
77</p>
78
79<p>
80<b>WARNING:</b> Running "ant download" command will download libraries required
81 to build Tomcat to the <code>/usr/share/java</code> directory by default.
82 On a typical Linux or MacOX system, an ordinary user
83 will not have access to write to this directory, and, even if you do,
84 it may not be appropriate for you to write there. On Windows
85 this usually corresponds to the <code>C:\usr\share\java</code> directory,
86 unless Cygwin is used. Read below to learn how to customize the directory
87 used to download the binaries.
88</p>
89
90<p>
91<b>NOTE:</b> Users accessing the Internet through a proxy must use a properties
92 file to indicate to Ant the proxy configuration. Read below.
93</p>
94
95<p>
96The build can be controlled by creating a ${tomcat.source}/build.properties
97 file, and adding the following content to it:
98<code><br>
99 # ----- Proxy setup -----<br>
100 # Uncomment if using a proxy server.<br>
101 #proxy.host=proxy.domain<br>
102 #proxy.port=8080<br>
103 #proxy.use=on<br>
104<br>
105 # ----- Default Base Path for Dependent Packages -----<br>
106 # Replace this path with the directory path where<br>
107 # dependencies binaries should be downloaded.<br>
108 base.path=/home/me/some-place-to-download-to<br>
109</code>
110</p>
111
112</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Building with Eclipse"><!--()--></a><a name="Building_with_Eclipse"><strong>Building with Eclipse</strong></a></font></td></tr><tr><td><blockquote>
113
114<p>
115<b>Important:</b>
116This is not a supported means of building Tomcat; this information is
117provided without warranty :-).
118The only supported means of building Tomcat is with the "ant build"
119described above.
120However, some developers like to work on Java code with a Java IDE,
121and the following steps have been used by some developers.
122</p>
123
124<p>
125Note that you <b>must</b> complete all the above steps to fetch
126dependent libraries and build some JAR files the first time.
127After you have completed the above steps, you can set up an
128Eclipse project.
129<b>Note</b> that this will not let you build everything under Eclipse;
130the build process requires use of Ant for the many stages that aren't
131simple Java compilations.
132However, it will allow you to view and edit the Java code,
133get warnings, reformat code, perform refactorings, run Tomcat
134under the IDE, and so on.
135</p>
136
137<p>
138Use Windows-&gt;Preferences and then Java-&gt;Build Path-&gt;Classpath
139Variables to add two new Classpath variables:
140</p>
141
142<p>
143<table border="1">
144 <tr><td>TOMCAT_LIBS_BASE</td><td>the base path where the binary dependencies have been downloaded</td></tr>
145 <tr><td>ANT_HOME</td><td>the base path of Ant 1.6.2 or later</td></tr>
146</table>
147</p>
148
149<p>
150There are two files in the root directory, <code>eclipse.classpath</code> and
151<code>eclipse.project</code>. Create their copies with new names,
152<code>.classpath</code> and <code>.project</code> respectively.
153</p>
154
155<p>
156Use File-&gt;Import and chose "Existing Projects into Workspace".
157From there import the root directory where you have checked out tomcat.
158</p>
159
160<p>
161Eclipse .project and .classpath files provided in the root directory of
162tomcat repository should allow Eclipse to find all source trees and jars, and
163hopefully compile without problems. <b>Note</b> that these
164files assume you are using Eclipse with a 5.0 or later JDK.
165</p>
166
167<p>
168To run Tomcat without a special IDE plug-in, you can simply use Run-&gt;Run...
169enter "org.apache.catalina.startup.Catalina" as the main class,
170"start" as program arguments, and
171"-Dcatalina.home=..." (with the name of your build directory)
172as VM arguments.
173</p>
174
175</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Building with other IDEs"><!--()--></a><a name="Building_with_other_IDEs"><strong>Building with other IDEs</strong></a></font></td></tr><tr><td><blockquote>
176<p>
177The same caveats apply as for Eclipse, above.
178</p>
179
180<p>
181The same general idea should work in most IDEs; it has been reported
182to work in Idea, for example.
183</p>
184
185</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
186 Copyright &copy; 1999-2014, Apache Software Foundation
187 </em></font></div></td></tr></table></body></html>