1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - Building Tomcat</title><meta value="Remy Maucherat" name="author"><meta value="" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" |
---|
2 | The Apache Tomcat Servlet/JSP Container |
---|
3 | " align="right" src="./../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="./../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat 6.0</h1><h2>Building Tomcat</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> |
---|
4 | |
---|
5 | <p> |
---|
6 | Building Apache Tomcat from SVN is very easy, and is the first step to contributing to |
---|
7 | Tomcat. The following is a step by step TODO list. |
---|
8 | </p> |
---|
9 | |
---|
10 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Download a Java Development Kit (JDK) release (version 1.5.x or later)"><strong>Download a Java Development Kit (JDK) release (version 1.5.x or later)</strong></a></font></td></tr><tr><td><blockquote> |
---|
11 | |
---|
12 | <p> |
---|
13 | The Sun JDK can be downloaded <a href="http://java.sun.com/j2se/">here</a>. |
---|
14 | </p> |
---|
15 | |
---|
16 | <p> |
---|
17 | <b>IMPORTANT</b>: Set an environment variable JAVA_HOME to the pathname of the |
---|
18 | directory into which you installed the JDK release. |
---|
19 | </p> |
---|
20 | |
---|
21 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><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> |
---|
22 | |
---|
23 | <p> |
---|
24 | Download a binary distribution of Ant 1.6.5 or later from |
---|
25 | <a href="http://ant.apache.org/bindownload.cgi">here</a>. |
---|
26 | </p> |
---|
27 | |
---|
28 | <p> |
---|
29 | Unpack the binary distribution into a convenient location so that the |
---|
30 | Ant release resides in its own directory (conventionally named |
---|
31 | "apache-ant-1.6.x"). For the purposes of the remainder of this document, |
---|
32 | the symbolic name "${ant.home}" is used to refer to the full pathname of |
---|
33 | the release directory. |
---|
34 | </p> |
---|
35 | |
---|
36 | <p> |
---|
37 | Create an ANT_HOME environment variable to point the directory ${ant.home}, |
---|
38 | and modify the PATH environment variable to include directory |
---|
39 | "${ant.home}/bin" in its list. This makes the "ant" command line script |
---|
40 | available, which will be used to actually perform the build. |
---|
41 | </p> |
---|
42 | |
---|
43 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><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> |
---|
44 | |
---|
45 | <p> |
---|
46 | Tomcat SVN repository URL: |
---|
47 | <code>http://svn.apache.org/repos/asf/tomcat/tc6.0.x/</code> |
---|
48 | </p> |
---|
49 | |
---|
50 | <p> |
---|
51 | Download a source package from: |
---|
52 | <code>http://tomcat.apache.org/download-60.cgi</code> |
---|
53 | </p> |
---|
54 | |
---|
55 | <p> |
---|
56 | Checkout the source using SVN, selecting the desired version or |
---|
57 | branch (current development source is at |
---|
58 | <code>http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/</code>), or |
---|
59 | unpack the source package. The location where the source has been |
---|
60 | placed will be referred as ${tomcat.source}. |
---|
61 | </p> |
---|
62 | |
---|
63 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Building Tomcat"><strong>Building Tomcat</strong></a></font></td></tr><tr><td><blockquote> |
---|
64 | |
---|
65 | <p> |
---|
66 | Use the following commands: |
---|
67 | <code><br> |
---|
68 | cd ${tomcat.source}<br> |
---|
69 | ant download<br> |
---|
70 | ant<br> |
---|
71 | </code> |
---|
72 | </p> |
---|
73 | |
---|
74 | <p> |
---|
75 | NOTE: Users accessing the Internet through a proxy must use a properties |
---|
76 | file to indicate to Ant the proxy configuration. Read below. |
---|
77 | </p> |
---|
78 | |
---|
79 | <p> |
---|
80 | WARNING: Running this command will download binaries to the |
---|
81 | <code>/usr/share/java</code> directory. |
---|
82 | Make sure this is appropriate to do so on your computer. On Windows, |
---|
83 | this usually corresponds to the <code>C:\usr\share\java</code> directory, |
---|
84 | unless Cygwin is used. Read below to customize the directory used |
---|
85 | to download the binaries. |
---|
86 | </p> |
---|
87 | |
---|
88 | <p> |
---|
89 | The build can be controlled by creating a ${tomcat.source}/build.properties |
---|
90 | file, and adding the following content to it: |
---|
91 | <code><br> |
---|
92 | # ----- Proxy setup -----<br> |
---|
93 | # Uncomment if using a proxy server.<br> |
---|
94 | #proxy.host=proxy.domain<br> |
---|
95 | #proxy.port=8080<br> |
---|
96 | #proxy.use=on<br> |
---|
97 | <br> |
---|
98 | # ----- Default Base Path for Dependent Packages -----<br> |
---|
99 | # Replace this path with the directory path where<br> |
---|
100 | # dependencies binaries should be downloaded.<br> |
---|
101 | base.path=/usr/share/java<br> |
---|
102 | </code> |
---|
103 | </p> |
---|
104 | |
---|
105 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Building with Eclipse"><strong>Building with Eclipse</strong></a></font></td></tr><tr><td><blockquote> |
---|
106 | |
---|
107 | <p> |
---|
108 | <b>Important:</b> |
---|
109 | This is not a supported means of building Tomcat; this information is |
---|
110 | provided without warranty :-). |
---|
111 | The only supported means of building Tomcat is with the "ant build" |
---|
112 | described above. |
---|
113 | However, some developers like to work on Java code with a Java IDE, |
---|
114 | and the following steps have been used by some developers. |
---|
115 | </p> |
---|
116 | |
---|
117 | <p> |
---|
118 | Note that you <b>must</b> complete all the above steps to fetch |
---|
119 | the repositories and build some JAR files the first time. |
---|
120 | After you have completed the above steps, you can set up a |
---|
121 | series of Eclipse 4 projects. |
---|
122 | <b>Note</b> that this will not let you build everything under Eclipse; |
---|
123 | the build process requires use of Ant for the many stages that aren't |
---|
124 | simple Java compilations. |
---|
125 | However, it will allow you to view and edit the Java code, |
---|
126 | get warnings, reformat code, perform refactorings, run Tomcat |
---|
127 | under the IDE, and so on. |
---|
128 | </p> |
---|
129 | |
---|
130 | <p> |
---|
131 | Use Windows->Preferences and then Java->Build Path->Classpath |
---|
132 | Variables to add two new Classpath variables: |
---|
133 | </p> |
---|
134 | |
---|
135 | <p> |
---|
136 | <table border="1"> |
---|
137 | <tr><td>TOMCAT_LIBS_BASE</td><td>the base path where the binary dependencies have been downloaded</td></tr> |
---|
138 | <tr><td>ANT_HOME</td><td>the base path of Ant 1.6.2 or later</td></tr> |
---|
139 | </table> |
---|
140 | </p> |
---|
141 | |
---|
142 | <p> |
---|
143 | Use File->New Project to create a new Java project |
---|
144 | for each of the binaries repository (e.g., /usr/share/java), |
---|
145 | container, connectors, jasper, servletapi. |
---|
146 | Unless you thought ahead to make the ${tomcat.source} directory be under |
---|
147 | your Workspace folder, tell Eclipse the external location using "Import/Export...", |
---|
148 | General->Existing Project into Workspace. |
---|
149 | </p> |
---|
150 | |
---|
151 | <p> |
---|
152 | Eclipse .project and .classpath files are provided in each of these |
---|
153 | directories so Eclipse should find all source trees and jars, and |
---|
154 | hopefully compile without problems. <b>Note</b> that these |
---|
155 | files assume you are using Eclipse with a 5.0 or later JDK; also, the |
---|
156 | connectors module must be built with a compiler compliance level of 5.0. |
---|
157 | </p> |
---|
158 | |
---|
159 | <p> |
---|
160 | To run Tomcat without a special IDE plug-in, you can simply use Run->Run... |
---|
161 | enter "org.apache.catalina.startup.Catalina" as the main class, |
---|
162 | "start" as program arguments, and |
---|
163 | "-Dcatalina.home=..." (with the name of your build directory) |
---|
164 | as VM arguments. |
---|
165 | </p> |
---|
166 | |
---|
167 | <p> |
---|
168 | Note also that due to the way the Tomcat source is assembled |
---|
169 | from several SVN projects, you may not be able to use the Eclipse |
---|
170 | SVN client to update (nor to commit, if you are a committer). |
---|
171 | Use the external SVN client of your choice, then use the |
---|
172 | Eclipse PackageExplorer or Navigator "Refresh" context menu item |
---|
173 | to tell Eclipse that you've updated the files. |
---|
174 | </p> |
---|
175 | |
---|
176 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Building with other IDEs"><strong>Building with other IDEs</strong></a></font></td></tr><tr><td><blockquote> |
---|
177 | <p> |
---|
178 | The same caveats apply as for Eclipse, above. |
---|
179 | </p> |
---|
180 | |
---|
181 | <p> |
---|
182 | The same general idea should work in most IDEs; it has been reported |
---|
183 | to work in Idea, for example. |
---|
184 | </p> |
---|
185 | |
---|
186 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> |
---|
187 | Copyright © 1999-2008, Apache Software Foundation |
---|
188 | </em></font></div></td></tr></table></body></html> |
---|