blob: b3a762e5c1c5d743de313f3473c5ddc99545298d [file] [log] [blame]
Hongqing Liufd5ee812014-05-10 16:32:51 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Application Developer's Guide (6.0.39) - Development Processes</title><meta name="author" content="Craig R. McClanahan"><style type="text/css" media="print">
2 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4 </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="
5 The Apache Tomcat Servlet/JSP Container
6 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 6.0</font></h1><font face="arial,helvetica,sanserif">Version 6.0.39, Jan 27 2014</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="nowrap" class="noPrint"><p><strong>Links</strong></p><ul><li><a href="../index.html">Docs Home</a></li></ul><p><strong>Contents</strong></p><ul><li><a href="index.html">Contents</a></li><li><a href="introduction.html">Introduction</a></li><li><a href="installation.html">Installation</a></li><li><a href="deployment.html">Deployment</a></li><li><a href="source.html">Source Code</a></li><li><a href="processes.html">Processes</a></li><li><a href="sample/">Example App</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Application Developer's Guide</h1><h2>Development Processes</h2><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>
7<ul><li><a href="#Development_Processes">Development Processes</a><ol><li><a href="#One-Time_Setup_of_Ant_and_Tomcat_for_Development">One-Time Setup of Ant and Tomcat for Development</a></li><li><a href="#Create_Project_Source_Code_Directory">Create Project Source Code Directory</a></li><li><a href="#Edit_Source_Code_and_Pages">Edit Source Code and Pages</a></li><li><a href="#Build_the_Web_Application">Build the Web Application</a></li><li><a href="#Test_Your_Web_Application">Test Your Web Application</a></li><li><a href="#Creating_a_Release">Creating a Release</a></li></ol></li></ul>
8</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Development Processes"><!--()--></a><a name="Development_Processes"><strong>Development Processes</strong></a></font></td></tr><tr><td><blockquote>
9
10<p>Although application development can take many forms, this manual proposes
11a fairly generic process for creating web applications using Tomcat. The
12following sections highlight the commands and tasks that you, as the developer
13of the code, will perform. The same basic approach works when you have
14multiple programmers involved, as long as you have an appropriate source code
15control system and internal team rules about who is working on what parts
16of the application at any given time.</p>
17
18<p>The task descriptions below assume that you will be using CVS for source
19code control, and that you have already configured access to the appropriate
20CVS repository. Instructions for doing this are beyond the scope of this
21manual. If you are using a different source code control environment, you
22will need to figure out the corresponding commands for your system.</p>
23
24
25<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="One-Time Setup of Ant and Tomcat for Development"><!--()--></a><a name="One-Time_Setup_of_Ant_and_Tomcat_for_Development"><strong>One-Time Setup of Ant and Tomcat for Development</strong></a></font></td></tr><tr><td><blockquote>
26
27<p>In order to take advantage of the special Ant tasks that interact with the
28<em>Manager</em> web application, you need to perform the following tasks
29once (no matter how many web applications you plan to develop).</p>
30<ul>
31<li><em>Configure the Ant custom tasks</em>. The implementation code for the
32 Ant custom tasks is in a JAR file named
33 <code>$CATALINA_HOME/lib/catalina-ant.jar</code>, which must be
34 copied in to the <code>lib</code> directory of your Ant installation.
35 <br><br></li>
36<li><em>Define one or more Tomcat users</em>. The <em>Manager</em> web
37 application runs under a security constraint that requires a user to be
38 logged in, and have the security role <code>manager</code> assigned to
39 him or her. How such users are defined depends on which Realm you have
40 configured in Tomcat's <code>conf/server.xml</code> file -- see the
41 <a href="../realm-howto.html">Realm Configuration HOW-TO</a> for more
42 information. You may define any number of users (with any username
43 and password that you like) with the <code>manager</code> role.
44 <br><br></li>
45</ul>
46
47</blockquote></td></tr></table>
48
49
50<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Create Project Source Code Directory"><!--()--></a><a name="Create_Project_Source_Code_Directory"><strong>Create Project Source Code Directory</strong></a></font></td></tr><tr><td><blockquote>
51
52<p>The first step is to create a new project source directory, and customize
53the <code>build.xml</code> and <code>build.properties</code> files you will
54be using. The directory structure is described in <a href="source.html">the
55previous section</a>, or you can use the
56<a href="sample/">sample application</a> as a starting point.</p>
57
58<p>Create your project source directory, and define it within your CVS
59repository. This might be done by a series of commands like this, where
60<code>{project}</code> is the name under which your project should be
61stored in the CVS repository, and {username} is your login username:</p>
62<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
63cd {my home directory}
64mkdir myapp &lt;-- Assumed "project source directory"
65cd myapp
66mkdir docs
67mkdir src
68mkdir web
69mkdir web/WEB-INF
70cvs import -m "Initial Project Creation" {project} \
71 {username} start
72</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
73
74<p>Now, to verify that it was created correctly in CVS, we will perform a
75checkout of the new project:</p>
76<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
77cd ..
78mv myapp myapp.bu
79cvs checkout {project}
80</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
81
82<p>Next, you will need to create and check in an initial version of the
83<code>build.xml</code> script to be used for development. For getting
84started quickly and easily, base your <code>build.xml</code> on the
85<a href="build.xml.txt">basic build.xml file</a>, included with this manual,
86or code it from scratch.</p>
87<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
88cd {my home directory}
89cd myapp
90emacs build.xml &lt;-- if you want a real editor :-)
91cvs add build.xml
92cvs commit
93</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
94
95<p>Until you perform the CVS commit, your changes are local to your own
96development directory. Committing makes those changes visible to other
97developers on your team that are sharing the same CVS repository.</p>
98
99<p>The next step is to customize the Ant <em>properties</em> that are
100named in the <code>build.xml</code> script. This is done by creating a
101file named <code>build.properties</code> in your project's top-level
102directory. The supported properties are listed in the comments inside
103the sample <code>build.xml</code> script. At a minimum, you will generally
104need to define the <code>catalina.home</code> property defining where
105Tomcat 6 is installed, and the manager application username and password.
106You might end up with something like this:</p>
107<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
108# Context path to install this application on
109app.path=/hello
110
111# Tomcat 6 installation directory
112catalina.home=/usr/local/apache-tomcat-6.0
113
114# Manager webapp username and password
115manager.username=myusername
116manager.password=mypassword
117</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
118
119<p>In general, you will <strong>not</strong> want to check the
120<code>build.properties</code> file in to the CVS repository, because it
121is unique to each developer's environment.</p>
122
123<p>Now, create the initial version of the web application deployment
124descriptor. You can base <code>web.xml</code> on the
125<a href="web.xml.txt">basic web.xml file</a>, or code it from scratch.</p>
126<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
127cd {my home directory}
128cd myapp/web/WEB-INF
129emacs web.xml
130cvs add web.xml
131cvs commit
132</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
133
134Note that this is only an example web.xml file. The full definition
135of the deployment descriptor file is in the
136<a href="http://wiki.apache.org/tomcat/Specifications">Servlet Specification.</a>
137
138</blockquote></td></tr></table>
139
140
141<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Edit Source Code and Pages"><!--()--></a><a name="Edit_Source_Code_and_Pages"><strong>Edit Source Code and Pages</strong></a></font></td></tr><tr><td><blockquote>
142
143<p>The edit/build/test tasks will generally be your most common activities
144during development and maintenance. The following general principles apply.
145As described in <a href="source.html">Source Organization</a>, newly created
146source files should be located in the appropriate subdirectory, under your
147project source directory.</p>
148
149<p>Whenever you wish to refresh your development directory to reflect the
150work performed by other developers, you will ask CVS to do it for you:</p>
151<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
152cd {my home directory}
153cd myapp
154cvs update -dP
155</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
156
157<p>To create a new file, go to the appropriate directory, create the file,
158and register it with CVS. When you are satisfied with it's contents (after
159building and testing is successful), commit the new file to the repository.
160For example, to create a new JSP page:</p>
161<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
162cd {my home directory}
163cd myapp/web &lt;-- Ultimate destination is document root
164emacs mypage.jsp
165cvs add mypage.jsp
166... build and test the application ...
167cvs commit
168</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
169
170<p>Java source code that is defined in packages must be organized in a
171directory hierarchy (under the <strong>src/</strong> subdirectory) that
172matches the package names. For example, a Java class named
173<code>com.mycompany.mypackage.MyClass.java</code> should be stored in file
174<code>src/com/mycompany/mypackage/MyClass.java</code>.
175Whenever you create a new subdirectory, don't forget to
176register it with CVS.</p>
177
178<p>To edit an existing source file, you will generally just start editing
179and testing, then commit the changed file when everything works. Although
180CVS can be configured to required you to "check out" or "lock" a file you
181are going to be modifying, this is generally not used.</p>
182
183</blockquote></td></tr></table>
184
185
186<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Build the Web Application"><!--()--></a><a name="Build_the_Web_Application"><strong>Build the Web Application</strong></a></font></td></tr><tr><td><blockquote>
187
188<p>When you are ready to compile the application, issue the following
189commands (generally, you will want a shell window open that is set to
190the project source directory, so that only the last command is needed):</p>
191<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
192cd {my home directory}
193cd myapp &lt;-- Normally leave a window open here
194ant
195</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
196
197<p>The Ant tool will be execute the default "compile" target in your
198<code>build.xml</code> file, which will compile any new or updated Java
199code. If this is the first time you compile after a "build clean",
200it will cause everything to be recompiled.</p>
201
202<p>To force the recompilation of your entire application, do this instead:</p>
203<div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
204cd {my home directory}
205cd myapp
206ant all
207</pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
208
209<p>This is a very good habit immediately before checking in changes, to
210make sure that you have not introduced any subtle problems that Javac's
211conditional checking did not catch.</p>
212
213</blockquote></td></tr></table>
214
215
216<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Test Your Web Application"><!--()--></a><a name="Test_Your_Web_Application"><strong>Test Your Web Application</strong></a></font></td></tr><tr><td><blockquote>
217
218<p>To test your application, you will want to install it under Tomcat. The
219quickest way to do that is to use the custom Ant tasks that are included in
220the sample <code>build.xml</code> script. Using these commands might follow
221a pattern like this:</p>
222<ul>
223<li><em>Start Tomcat 6 if needed</em>. If Tomcat 6 is not already running,
224 you will need to start it in the usual way.
225 <br><br></li>
226<li><em>Compile your application</em>. Use the <code>ant compile</code>
227 command (or just <code>ant</code>, since this is the default). Make
228 sure that there are no compilation errors.
229 <br><br></li>
230<li><em>Install the application</em>. Use the <code>ant install</code>
231 command. This tells Tomcat to immediately start running your app on
232 the context path defined in the <code>app.path</code> build property.
233 Tomcat does <strong>NOT</strong> have to be restarted for this to
234 take effect.<br><br></li>
235<li><em>Test the application</em>. Using your browser or other testing
236 tools, test the functionality of your application.
237 <br><br></li>
238<li><em>Modify and rebuild as needed</em>. As you discover that changes
239 are required, make those changes in the original <strong>source</strong>
240 files, not in the output build directory, and re-issue the
241 <code>ant compile</code> command. This ensures that your changes will
242 be available to be saved (via <code>cvs commit</code>) later on --
243 the output build directory is deleted and recreated as necessary.
244 <br><br></li>
245<li><em>Reload the application</em>. Tomcat will recognize changes in
246 JSP pages automatically, but it will continue to use the old versions
247 of any servlet or JavaBean classes until the application is reloaded.
248 You can trigger this by executing the <code>ant reload</code> command.
249 <br><br></li>
250<li><em>Remove the application when you re done</em>. When you are through
251 working on this application, you can remove it from live execution by
252 running the <code>ant remove</code> command.</li>
253</ul>
254
255<p>Do not forget to commit your changes to the source code repository when
256you have completed your testing!</p>
257
258</blockquote></td></tr></table>
259
260
261<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Creating a Release"><!--()--></a><a name="Creating_a_Release"><strong>Creating a Release</strong></a></font></td></tr><tr><td><blockquote>
262
263<p>When you are through adding new functionality, and you've tested everything
264(you DO test, don't you :-), it is time to create the distributable version
265of your web application that can be deployed on the production server. The
266following general steps are required:</p>
267<ul>
268<li>Issue the command <code>ant all</code> from the project source
269 directory, to rebuild everything from scratch one last time.
270 <br><br></li>
271<li>Use the <code>cvs tag</code> command to create an identifier for
272 all of the source files utilized to create this release. This allows
273 you to reliably reconstruct a release (from sources) at a later
274 time.</li>
275<li>Issue the command <code>ant dist</code> to create a distributable
276 web application archive (WAR) file, as well as a JAR file containing
277 the corresponding source code.
278 <br><br></li>
279<li>Package the contents of the <code>dist</code> directory using the
280 <strong>tar</strong> or <strong>zip</strong> utility, according to
281 the standard release procedures used by your organization.</li>
282</ul>
283
284</blockquote></td></tr></table>
285
286
287</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>
288 Copyright &copy; 1999-2014, Apache Software Foundation
289 </em></font></div></td></tr></table></body></html>