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