刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.77) - Building Tomcat</title><style type="text/css" media="print">
|
| 2 | .noPrint {display: none;}
|
| 3 | td#mainBody {width: 100%;}
|
| 4 | </style><style type="text/css">
|
| 5 | code {background-color:rgb(224,255,255);padding:0 0.1em;}
|
| 6 | code.attributeName, code.propertyName {background-color:transparent;}
|
| 7 |
|
| 8 |
|
| 9 | table {
|
| 10 | border-collapse: collapse;
|
| 11 | text-align: left;
|
| 12 | }
|
| 13 | table *:not(table) {
|
| 14 | /* Prevent border-collapsing for table child elements like <div> */
|
| 15 | border-collapse: separate;
|
| 16 | }
|
| 17 |
|
| 18 | th {
|
| 19 | text-align: left;
|
| 20 | }
|
| 21 |
|
| 22 |
|
| 23 | div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
|
| 24 | background-color: transparent;
|
| 25 | }
|
| 26 | div.codeBox {
|
| 27 | overflow: auto;
|
| 28 | margin: 1em 0;
|
| 29 | }
|
| 30 | div.codeBox pre {
|
| 31 | margin: 0;
|
| 32 | padding: 4px;
|
| 33 | border: 1px solid #999;
|
| 34 | border-radius: 5px;
|
| 35 | background-color: #eff8ff;
|
| 36 | display: table; /* To prevent <pre>s from taking the complete available width. */
|
| 37 | /*
|
| 38 | When it is officially supported, use the following CSS instead of display: table
|
| 39 | to prevent big <pre>s from exceeding the browser window:
|
| 40 | max-width: available;
|
| 41 | width: min-content;
|
| 42 | */
|
| 43 | }
|
| 44 |
|
| 45 | div.codeBox pre.wrap {
|
| 46 | white-space: pre-wrap;
|
| 47 | }
|
| 48 |
|
| 49 |
|
| 50 | table.defaultTable tr, table.detail-table tr {
|
| 51 | border: 1px solid #CCC;
|
| 52 | }
|
| 53 |
|
| 54 | table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
|
| 55 | background-color: #FAFBFF;
|
| 56 | }
|
| 57 |
|
| 58 | table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
|
| 59 | background-color: #EEEFFF;
|
| 60 | }
|
| 61 |
|
| 62 | table.defaultTable th, table.detail-table th {
|
| 63 | background-color: #88b;
|
| 64 | color: #fff;
|
| 65 | }
|
| 66 |
|
| 67 | table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
|
| 68 | padding: 5px 8px;
|
| 69 | }
|
| 70 |
|
| 71 |
|
| 72 | p.notice {
|
| 73 | border: 1px solid rgb(255, 0, 0);
|
| 74 | background-color: rgb(238, 238, 238);
|
| 75 | color: rgb(0, 51, 102);
|
| 76 | padding: 0.5em;
|
| 77 | margin: 1em 2em 1em 1em;
|
| 78 | }
|
| 79 | </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="
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 80 | The Apache Tomcat Servlet/JSP Container
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 81 | " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.77, Mar 28 2017</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.svg" align="right" alt="Apache Logo" border="0" style="width: 266px;height: 83px;"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" 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><li><a href="#comments_section">User Comments</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/TLS</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-descriptors-howto.html">16) MBeans Descriptors</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><li><a href="security-howto.html">28) Security Considerations</a></li><li><a href="windows-service-howto.html">29) Windows Service</a></li><li><a href="windows-auth-howto.html">30) Windows Authentication</a></li><li><a href="jdbc-pool.html">31) Tomcat's JDBC Pool</a></li><li><a href="web-socket-howto.html">32) WebSocket</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">Tomcat Javadocs</a></li><li><a href="servletapi/index.html">Servlet Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.2 Javadocs</a></li><li><a href="elapi/index.html">EL 2.2 Javadocs</a></li><li><a href="websocketapi/index.html">WebSocket 1.1 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><li><a href="tribes/introduction.html">Tribes</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Building Tomcat</h1><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>
|
| 82 | <ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Download_Java_Development_Kit_(JDK)_versions_6_and_7">Download Java Development Kit (JDK) versions 6 and 7</a></li><li><a href="#Install_Apache_Ant_1.8.2_or_later">Install Apache Ant 1.8.2 or later</a></li><li><a href="#Checkout_or_obtain_the_source_code_for_Tomcat_7.0">Checkout or obtain the source code for Tomcat 7.0</a></li><li><a href="#Configure_download_area">Configure download area</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>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 83 | </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>
|
| 84 |
|
| 85 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 86 | Building Apache Tomcat from source is very easy, and is the first step to
|
| 87 | contributing to Tomcat. The complete and comprehensive instructions are
|
| 88 | provided in the file <a href="BUILDING.txt">BUILDING.txt</a>.
|
| 89 | The following is a quick step by step guide.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 90 | </p>
|
| 91 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 92 | </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 Java Development Kit (JDK) versions 6 and 7"><!--()--></a><a name="Download_Java_Development_Kit_(JDK)_versions_6_and_7"><strong>Download Java Development Kit (JDK) versions 6 and 7</strong></a></font></td></tr><tr><td><blockquote>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 93 |
|
| 94 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 95 | Building Apache Tomcat requires a Java 6 JDK to be installed and optionally
|
| 96 | a Java 7 JDK installed in parallel with Java 6 one. The Java 7 JDK is only
|
| 97 | required if you wish to build Tomcat with JSR-356 (Java WebSocket 1.1)
|
| 98 | support.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 99 | </p>
|
| 100 |
|
| 101 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 102 | You can download JDKs from Oracle<br>
|
| 103 | <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a><br>
|
| 104 | or from another JDK vendor.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 105 | </p>
|
| 106 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 107 | <p>
|
| 108 | <b>IMPORTANT</b>: Set an environment variable JAVA_HOME to the pathname of
|
| 109 | the directory into which you installed the Java 6 JDK. The path to Java 7
|
| 110 | JDK is configured in <code>build.properties</code> file (see below).
|
| 111 | </p>
|
| 112 |
|
| 113 | </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.8.2 or later"><!--()--></a><a name="Install_Apache_Ant_1.8.2_or_later"><strong>Install Apache Ant 1.8.2 or later</strong></a></font></td></tr><tr><td><blockquote>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 114 |
|
| 115 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 116 | Download a binary distribution of Ant 1.8.2 or later from
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 117 | <a href="http://ant.apache.org/bindownload.cgi">here</a>.
|
| 118 | </p>
|
| 119 |
|
| 120 | <p>
|
| 121 | Unpack the binary distribution into a convenient location so that the
|
| 122 | Ant release resides in its own directory (conventionally named
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 123 | <code>apache-ant-1.8.x</code>). For the remainder of this guide,
|
| 124 | the symbolic name <code>${ant.home}</code> is used to refer to the full pathname of
|
| 125 | the Ant installation directory.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 126 | </p>
|
| 127 |
|
| 128 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 129 | <b>IMPORTANT</b>: Create an ANT_HOME environment variable to point the directory <code>${ant.home}</code>,
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 130 | and modify the PATH environment variable to include directory
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 131 | <code>${ant.home}/bin</code> in its list. This makes the <code>ant</code> command line script
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 132 | available, which will be used to actually perform the build.
|
| 133 | </p>
|
| 134 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 135 | </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 7.0"><!--()--></a><a name="Checkout_or_obtain_the_source_code_for_Tomcat_7.0"><strong>Checkout or obtain the source code for Tomcat 7.0</strong></a></font></td></tr><tr><td><blockquote>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 136 |
|
| 137 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 138 | Tomcat 7.0 SVN repository URL:
|
| 139 | <a href="http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/">http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/</a>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 140 | </p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 141 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 142 | Tomcat source packages:
|
| 143 | <a href="http://tomcat.apache.org/download-70.cgi">http://tomcat.apache.org/download-70.cgi</a>.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 144 | </p>
|
| 145 |
|
| 146 | <p>
|
| 147 | Checkout the source using SVN, selecting a tag for released version or
|
| 148 | trunk for the current development code, or download and unpack a
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 149 | source package. For the remainder of this guide, the symbolic name
|
| 150 | <code>${tomcat.source}</code> is used to refer to the
|
| 151 | location where the source has been placed.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 152 | </p>
|
| 153 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 154 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Configure download area"><!--()--></a><a name="Configure_download_area"><strong>Configure download area</strong></a></font></td></tr><tr><td><blockquote>
|
| 155 |
|
| 156 | <p>
|
| 157 | Building Tomcat involves downloading a number of libraries that it depends on.
|
| 158 | It is strongly recommended to configure download area for those libraries.
|
| 159 | </p>
|
| 160 |
|
| 161 | <p>
|
| 162 | By default the build is configured to download the dependencies into the
|
| 163 | <code>${user.home}/tomcat-build-libs</code> directory. You can change this
|
| 164 | (see below) but it must be an absolute path.
|
| 165 | </p>
|
| 166 |
|
| 167 | <p>
|
| 168 | The build is controlled by creating a
|
| 169 | <code>${tomcat.source}/build.properties</code> file. It can be used to
|
| 170 | redefine any property that is present in <code>build.properties.default</code>
|
| 171 | and <code>build.xml</code> files. The <code>build.properties</code> file
|
| 172 | does not exist by default. You have to create it.
|
| 173 | </p>
|
| 174 |
|
| 175 | <p>
|
| 176 | The download area is defined by property <code>base.path</code>. For example:
|
| 177 | </p>
|
| 178 |
|
| 179 | <div class="codeBox"><pre><code># ----- Default Base Path for Dependent Packages -----
|
| 180 | # Replace this path with the directory path where
|
| 181 | # dependencies binaries should be downloaded.
|
| 182 | base.path=/home/me/some-place-to-download-to</code></pre></div>
|
| 183 |
|
| 184 | <p>
|
| 185 | Different versions of Tomcat are allowed to share the same download area.
|
| 186 | </p>
|
| 187 |
|
| 188 | <p>
|
| 189 | Another example:
|
| 190 | </p>
|
| 191 |
|
| 192 | <div class="codeBox"><pre><code>base.path=${user.dir}/../libraries-tomcat7.0</code></pre></div>
|
| 193 |
|
| 194 | <p>
|
| 195 | Users who access the Internet through a proxy must use the properties
|
| 196 | file to indicate to Ant the proxy configuration:
|
| 197 | </p>
|
| 198 |
|
| 199 | <div class="codeBox"><pre><code># ----- Proxy setup -----
|
| 200 | proxy.host=proxy.domain
|
| 201 | proxy.port=8080
|
| 202 | proxy.use=on</code></pre></div>
|
| 203 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 204 | </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>
|
| 205 |
|
| 206 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 207 | If you have installed a Java 7 JDK and wish to build Tomcat with JSR-356
|
| 208 | (Java WebSocket 1.1) support, set <code>java.7.home</code> property in
|
| 209 | file <code>${tomcat.source}/build.properties</code> to the location of
|
| 210 | the Java 7 JDK installation.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 211 | </p>
|
| 212 |
|
| 213 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 214 | An example, using 32-bit JDK on a 64-bit Windows system:
|
| 215 | </p>
|
| 216 |
|
| 217 | <div class="codeBox"><pre><code># Location of Java 7 JDK
|
| 218 | java.7.home=C:/Program Files (x86)/Java/jdk1.7.0_72</code></pre></div>
|
| 219 |
|
| 220 | <p>
|
| 221 | Use the following commands to build Tomcat:
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 222 | </p>
|
| 223 |
|
| 224 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 225 | <code>cd ${tomcat.source}</code><br>
|
| 226 | <code>ant</code>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 227 | </p>
|
| 228 |
|
| 229 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 230 | Once the build has completed successfully, a usable Tomcat installation will have been
|
| 231 | produced in the <code>${tomcat.source}/output/build</code> directory, and can be started
|
| 232 | and stopped with the usual scripts.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 233 | </p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 234 | </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>
|
| 235 |
|
| 236 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 237 | <b>IMPORTANT:</b> This is not a supported means of building Tomcat; this information is
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 238 | provided without warranty :-).
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 239 | The only supported means of building Tomcat is with the Ant build described above.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 240 | However, some developers like to work on Java code with a Java IDE,
|
| 241 | and the following steps have been used by some developers.
|
| 242 | </p>
|
| 243 |
|
| 244 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 245 | <b>NOTE:</b> This will not let you build everything under Eclipse;
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 246 | the build process requires use of Ant for the many stages that aren't
|
| 247 | simple Java compilations.
|
| 248 | However, it will allow you to view and edit the Java code,
|
| 249 | get warnings, reformat code, perform refactorings, run Tomcat
|
| 250 | under the IDE, and so on.
|
| 251 | </p>
|
| 252 |
|
| 253 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 254 | <b>WARNING:</b> Do not forget to create and configure
|
| 255 | <code>${tomcat.source}/build.properties</code> file as described above
|
| 256 | before running any Ant targets.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 257 | </p>
|
| 258 |
|
| 259 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 260 | Sample Eclipse project files and launch targets are provided in the
|
| 261 | <code>res/ide-support/eclipse</code> directory of the source tree.
|
| 262 | The instructions below will automatically copy these into the required locations.
|
| 263 | </p>
|
| 264 | <p>
|
| 265 | Two Ant targets are provided as a convenience. The first one, named
|
| 266 | <em>ide-eclipse</em>, downloads all binary dependencies and configures
|
| 267 | Eclipse project in the root of the source tree. The created Eclipse project
|
| 268 | targets a Java 6 JDK and skips WebSocket classes that cannot be compiled with
|
| 269 | Java 6.
|
| 270 | </p>
|
| 271 |
|
| 272 | <p>
|
| 273 | The second target, named <em>ide-eclipse-websocket</em>, creates directory
|
| 274 | <code>../tomcat-7.0.x-java7</code> and configures the second Eclipse project
|
| 275 | there. This project targets a Java 7 JDK. This project does not have its own
|
| 276 | source tree, but accesses a subset of the source tree of the first project,
|
| 277 | compiling all WebSocket classes that were skipped.
|
| 278 | </p>
|
| 279 |
|
| 280 | <p>
|
| 281 | <code>cd ${tomcat.source}</code><br>
|
| 282 | <code>ant ide-eclipse</code><br>
|
| 283 | <code>ant ide-eclipse-websocket</code>
|
| 284 | </p>
|
| 285 |
|
| 286 | <p>
|
| 287 | Start Eclipse and create a new Workspace.
|
| 288 | </p>
|
| 289 |
|
| 290 | <p>
|
| 291 | Open the <em>Preferences</em> dialog and then select <em>Java->Build Path->Classpath
|
| 292 | Variables</em> to add two new <em>Classpath Variables</em>:
|
| 293 | </p>
|
| 294 |
|
| 295 |
|
| 296 | <table class="defaultTable">
|
| 297 | <tr><td>TOMCAT_LIBS_BASE</td><td>The same location as the <code>base.path</code>
|
| 298 | setting in <code>build.properties</code>, where the binary dependencies have been downloaded</td></tr>
|
| 299 | <tr><td>ANT_HOME</td><td>the base path of Ant 1.8.2 or later</td></tr>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 300 | </table>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 301 |
|
| 302 | <p>
|
| 303 | In the <em>Preferences</em> dialog go to <em>Java->Installed JREs</em>
|
| 304 | and add JDK 6 and JDK 7 there. Close the dialog.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 305 | </p>
|
| 306 |
|
| 307 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 308 | Use <em>File->Import</em> command from menu and choose <em>Existing Projects into Workspace</em>.
|
| 309 | From there choose the root directory of the Tomcat source tree (<code>${tomcat.source}</code>)
|
| 310 | and import the project located there. Import the second project as well,
|
| 311 | if you have created it (<code>../tomcat-7.0.x-java7</code>).
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 312 | </p>
|
| 313 |
|
| 314 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 315 | <code>start-tomcat</code> and <code>stop-tomcat</code> launch configurations are provided in
|
| 316 | <code>res/ide-support/eclipse</code> and will be available in the <em>Run->Run Configurations</em>
|
| 317 | dialog. Use these to start and stop Tomcat from Eclipse.
|
| 318 | If you want to configure these yourself (or are using a different IDE)
|
| 319 | then use <code>org.apache.catalina.startup.Bootstrap</code> as the main class,
|
| 320 | <code>start</code>/<code>stop</code> etc. as program arguments, and specify <code>-Dcatalina.home=...</code>
|
| 321 | (with the name of your build directory) as VM arguments.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 322 | </p>
|
| 323 |
|
| 324 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 325 | Tweaking a few formatting preferences will make it much easier to keep consistent with Tomcat
|
| 326 | coding conventions (and have your contributions accepted):
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 327 | </p>
|
| 328 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 329 | <table class="defaultTable">
|
| 330 | <tr><td>Java -> Code Style -> Formatter -> Edit...</td>
|
| 331 | <td>Tab policy: Spaces only<br>Tab and Indentation size: 4</td></tr>
|
| 332 | <tr><td>General -> Editors -> Text Editors</td>
|
| 333 | <td>Displayed tab width: 2<br>Insert spaces for tabs<br>Show whitespace characters (optional)</td></tr>
|
| 334 | <tr><td>XML -> XML Files -> Editor</td><td>Indent using spaces<br>Indentation size: 2</td></tr>
|
| 335 | <tr><td>Ant -> Editor -> Formatter</td><td>Tab size: 2<br>Use tab character instead of spaces: unchecked</td></tr>
|
| 336 | </table>
|
| 337 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 338 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 339 | The recommended configuration of Compiler Warnings is documented in
|
| 340 | <code>res/ide-support/eclipse/java-compiler-errors-warnings.txt</code> file.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 341 | </p>
|
| 342 |
|
| 343 | </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>
|
| 344 | <p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 345 | The same general approach should work for most IDEs; it has been reported
|
| 346 | to work in IntelliJ IDEA, for example.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 347 | </p>
|
| 348 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 349 | </blockquote></td></tr></table></td></tr><tr class="noPrint"><td width="20%" valign="top" nowrap class="noPrint"></td><td width="80%" valign="top" align="left"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="comments_section" id="comments_section"><strong>Comments</strong></a></font></td></tr><tr><td><blockquote><p class="notice"><strong>Notice: </strong>This comments section collects your suggestions
|
| 350 | on improving documentation for Apache Tomcat.<br><br>
|
| 351 | If you have trouble and need help, read
|
| 352 | <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
|
| 353 | and ask your question on the tomcat-users
|
| 354 | <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
|
| 355 | Do not ask such questions here. This is not a Q&A section.<br><br>
|
| 356 | The Apache Comments System is explained <a href="./comments.html">here</a>.
|
| 357 | Comments may be removed by our moderators if they are either
|
| 358 | implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
|
| 359 | var comments_shortname = 'tomcat';
|
| 360 | var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/building.html';
|
| 361 | (function(w, d) {
|
| 362 | if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
|
| 363 | d.write('<div id="comments_thread"><\/div>');
|
| 364 | var s = d.createElement('script');
|
| 365 | s.type = 'text/javascript';
|
| 366 | s.async = true;
|
| 367 | s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
|
| 368 | (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
|
| 369 | }
|
| 370 | else {
|
| 371 | d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
|
| 372 | }
|
| 373 | })(window, document);
|
| 374 | //--><!]]></script></blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
|
| 375 | Copyright © 1999-2017, Apache Software Foundation
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 376 | </em></font></div></td></tr></table></body></html> |