1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
|
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE document [
<!ENTITY project SYSTEM "project.xml">
]>
<document>
&project;
<properties>
<author>Remy Maucherat</author>
<title>Building Tomcat</title>
</properties>
<body>
<section name="Table of Contents">
<toc/>
</section>
<section name="Introduction">
<p>
Building Apache Tomcat from SVN is very easy, and is the first step to contributing to
Tomcat. The following is a step by step TODO list.
</p>
</section>
<section name="Download a Java Development Kit (JDK) release (version 1.5.x or later)">
<p>
The Sun JDK can be downloaded <a href="http://java.sun.com/j2se/">here</a>.
</p>
<p>
<b>IMPORTANT</b>: Set an environment variable JAVA_HOME to the pathname of the
directory into which you installed the JDK release.
</p>
</section>
<section name="Install Apache Ant 1.6.5 or later">
<p>
Download a binary distribution of Ant 1.6.5 or later from
<a href="http://ant.apache.org/bindownload.cgi">here</a>.
</p>
<p>
Unpack the binary distribution into a convenient location so that the
Ant release resides in its own directory (conventionally named
"apache-ant-1.6.x"). For the purposes of the remainder of this document,
the symbolic name "${ant.home}" is used to refer to the full pathname of
the release directory.
</p>
<p>
Create an ANT_HOME environment variable to point the directory ${ant.home},
and modify the PATH environment variable to include directory
"${ant.home}/bin" in its list. This makes the "ant" command line script
available, which will be used to actually perform the build.
</p>
</section>
<section name="Checkout or obtain the source code for Tomcat 6.0">
<p>
Tomcat 6.0 SVN repository URL:
<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>
</p>
<p>
Download a source package from:
<a href="http://tomcat.apache.org/download-60.cgi">http://tomcat.apache.org/download-60.cgi</a>
</p>
<p>
Checkout the source using SVN, selecting a tag for released version or
trunk for the current development code, or download and unpack a
source package. The location where the source has been
placed will be referred as <code>${tomcat.source}</code>.
</p>
</section>
<section name="Building Tomcat">
<p>
Use the following commands:
<code><br/>
cd ${tomcat.source}<br/>
ant download<br/>
ant<br/>
</code>
</p>
<p>
<b>WARNING:</b> Running "ant download" command will download libraries required
to build Tomcat to the <code>/usr/share/java</code> directory by default.
On a typical Linux or MacOX system, an ordinary user
will not have access to write to this directory, and, even if you do,
it may not be appropriate for you to write there. On Windows
this usually corresponds to the <code>C:\usr\share\java</code> directory,
unless Cygwin is used. Read below to learn how to customize the directory
used to download the binaries.
</p>
<p>
<b>NOTE:</b> Users accessing the Internet through a proxy must use a properties
file to indicate to Ant the proxy configuration. Read below.
</p>
<p>
The build can be controlled by creating a ${tomcat.source}/build.properties
file, and adding the following content to it:
<code><br/>
# ----- Proxy setup -----<br/>
# Uncomment if using a proxy server.<br/>
#proxy.host=proxy.domain<br/>
#proxy.port=8080<br/>
#proxy.use=on<br/>
<br/>
# ----- Default Base Path for Dependent Packages -----<br/>
# Replace this path with the directory path where<br/>
# dependencies binaries should be downloaded.<br/>
base.path=/home/me/some-place-to-download-to<br/>
</code>
</p>
</section>
<section name="Building with Eclipse">
<p>
<b>Important:</b>
This is not a supported means of building Tomcat; this information is
provided without warranty :-).
The only supported means of building Tomcat is with the "ant build"
described above.
However, some developers like to work on Java code with a Java IDE,
and the following steps have been used by some developers.
</p>
<p>
Note that you <b>must</b> complete all the above steps to fetch
dependent libraries and build some JAR files the first time.
After you have completed the above steps, you can set up an
Eclipse project.
<b>Note</b> that this will not let you build everything under Eclipse;
the build process requires use of Ant for the many stages that aren't
simple Java compilations.
However, it will allow you to view and edit the Java code,
get warnings, reformat code, perform refactorings, run Tomcat
under the IDE, and so on.
</p>
<p>
Use Windows->Preferences and then Java->Build Path->Classpath
Variables to add two new Classpath variables:
</p>
<p>
<table border="1">
<tr><td>TOMCAT_LIBS_BASE</td><td>the base path where the binary dependencies have been downloaded</td></tr>
<tr><td>ANT_HOME</td><td>the base path of Ant 1.6.2 or later</td></tr>
</table>
</p>
<p>
There are two files in the root directory, <code>eclipse.classpath</code> and
<code>eclipse.project</code>. Create their copies with new names,
<code>.classpath</code> and <code>.project</code> respectively.
</p>
<p>
Use File->Import and chose "Existing Projects into Workspace".
From there import the root directory where you have checked out tomcat.
</p>
<p>
Eclipse .project and .classpath files provided in the root directory of
tomcat repository should allow Eclipse to find all source trees and jars, and
hopefully compile without problems. <b>Note</b> that these
files assume you are using Eclipse with a 5.0 or later JDK.
</p>
<p>
To run Tomcat without a special IDE plug-in, you can simply use Run->Run...
enter "org.apache.catalina.startup.Catalina" as the main class,
"start" as program arguments, and
"-Dcatalina.home=..." (with the name of your build directory)
as VM arguments.
</p>
</section>
<section name="Building with other IDEs">
<p>
The same caveats apply as for Eclipse, above.
</p>
<p>
The same general idea should work in most IDEs; it has been reported
to work in Idea, for example.
</p>
</section>
</body>
</document>
|