189 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			189 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| 
								 | 
							
								<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - Building Tomcat</title><meta name="author" value="Remy Maucherat"><meta name="email" value=""></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="
							 | 
						||
| 
								 | 
							
								      The Apache Tomcat Servlet/JSP Container
							 | 
						||
| 
								 | 
							
								    " border="0"></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 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="true"><p><strong>Links</strong></p><ul><li><a href="index.html">Docs Home</a></li><li><a href="http://tomcat.apache.org/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</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="status.html">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"><table border="0" width="100%" cellspacing="4"><tr><td align="left" valign="top"><h1>Apache Tomcat 6.0</h1><h2>Building Tomcat</h2></td><td align="right" valign="top" nowrap="true"><small><a href="printer/"><img src="./images/printer.gif" border="0" alt="Printer Friendly Version"><br>print-friendly<br>version
							 | 
						||
| 
								 | 
							
								                    </a></small></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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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 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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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"><strong>Install Apache Ant 1.6.5 or later</strong></a></font></td></tr><tr><td><blockquote>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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"><strong>Checkout or obtain the source code for Tomcat 6.0</strong></a></font></td></tr><tr><td><blockquote>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  <p>
							 | 
						||
| 
								 | 
							
								  Tomcat SVN repository URL:
							 | 
						||
| 
								 | 
							
								  <code>http://svn.apache.org/repos/asf/tomcat/tc6.0.x/</code>
							 | 
						||
| 
								 | 
							
								  </p>
							 | 
						||
| 
								 | 
							
								  
							 | 
						||
| 
								 | 
							
								  <p>
							 | 
						||
| 
								 | 
							
								  Download a source package from:
							 | 
						||
| 
								 | 
							
								  <code>http://tomcat.apache.org/download-60.cgi</code>
							 | 
						||
| 
								 | 
							
								  </p>
							 | 
						||
| 
								 | 
							
								  
							 | 
						||
| 
								 | 
							
								  <p>
							 | 
						||
| 
								 | 
							
								  Checkout the source using SVN, selecting the desired version or
							 | 
						||
| 
								 | 
							
								  branch (current development source is at 
							 | 
						||
| 
								 | 
							
								  <code>http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/</code>), or 
							 | 
						||
| 
								 | 
							
								  unpack the source package. The location where the source has been
							 | 
						||
| 
								 | 
							
								  placed will be referred as ${tomcat.source}.
							 | 
						||
| 
								 | 
							
								  </p>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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"><strong>Building Tomcat</strong></a></font></td></tr><tr><td><blockquote>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								Use the following commands:
							 | 
						||
| 
								 | 
							
								<code><br>
							 | 
						||
| 
								 | 
							
								    cd ${tomcat.source}<br>
							 | 
						||
| 
								 | 
							
								    ant download<br>
							 | 
						||
| 
								 | 
							
								    ant<br>
							 | 
						||
| 
								 | 
							
								</code>
							 | 
						||
| 
								 | 
							
								</p>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								NOTE: Users accessing the Internet through a proxy must use a properties
							 | 
						||
| 
								 | 
							
								  file to indicate to Ant the proxy configuration. Read below.
							 | 
						||
| 
								 | 
							
								</p>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								WARNING: Running this command will download binaries to the 
							 | 
						||
| 
								 | 
							
								  <code>/usr/share/java</code> directory. 
							 | 
						||
| 
								 | 
							
								  Make sure this is appropriate to do so on your computer. On Windows, 
							 | 
						||
| 
								 | 
							
								  this usually corresponds to the <code>C:\usr\share\java</code> directory, 
							 | 
						||
| 
								 | 
							
								  unless Cygwin is used. Read below to customize the directory used 
							 | 
						||
| 
								 | 
							
								  to download the binaries.
							 | 
						||
| 
								 | 
							
								</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=/usr/share/java<br>
							 | 
						||
| 
								 | 
							
								</code>
							 | 
						||
| 
								 | 
							
								</p>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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"><strong>Building with Eclipse</strong></a></font></td></tr><tr><td><blockquote>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<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
							 | 
						||
| 
								 | 
							
								the repositories and build some JAR files the first time.
							 | 
						||
| 
								 | 
							
								After you have completed the above steps, you can set up a
							 | 
						||
| 
								 | 
							
								series of Eclipse 4 projects.
							 | 
						||
| 
								 | 
							
								<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>
							 | 
						||
| 
								 | 
							
								Use File->New Project to create a new Java project 
							 | 
						||
| 
								 | 
							
								for each of the binaries repository (e.g., /usr/share/java), 
							 | 
						||
| 
								 | 
							
								container, connectors, jasper, servletapi. 
							 | 
						||
| 
								 | 
							
								Unless you thought ahead to make the ${tomcat.source} directory be under
							 | 
						||
| 
								 | 
							
								your Workspace folder, tell Eclipse the external location using "Import/Export...",
							 | 
						||
| 
								 | 
							
								General->Existing Project into Workspace.
							 | 
						||
| 
								 | 
							
								</p>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								Eclipse .project and .classpath files are provided in each of these
							 | 
						||
| 
								 | 
							
								directories so Eclipse should 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; also, the
							 | 
						||
| 
								 | 
							
								connectors module must be built with a compiler compliance level of 5.0.
							 | 
						||
| 
								 | 
							
								</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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<p>
							 | 
						||
| 
								 | 
							
								Note also that due to the way the Tomcat source is assembled
							 | 
						||
| 
								 | 
							
								from several SVN projects, you may not be able to use the Eclipse
							 | 
						||
| 
								 | 
							
								SVN client to update (nor to commit, if you are a committer).
							 | 
						||
| 
								 | 
							
								Use the external SVN client of your choice, then use the
							 | 
						||
| 
								 | 
							
								Eclipse PackageExplorer or Navigator "Refresh" context menu item
							 | 
						||
| 
								 | 
							
								to tell Eclipse that you've updated the files.
							 | 
						||
| 
								 | 
							
								</p>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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"><strong>Building with other IDEs</strong></a></font></td></tr><tr><td><blockquote>
							 | 
						||
| 
								 | 
							
								<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>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</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>
							 | 
						||
| 
								 | 
							
								        Copyright © 1999-2006, Apache Software Foundation
							 | 
						||
| 
								 | 
							
								        </em></font></div></td></tr></table></body></html>
							 |