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