3.2.3.4 Building the Application
To build the application, please run the build.sh script from your local source code root directory
myApp.
$ cd ~/myApp
$ ./build.sh
The build script will automatically determine which files have to be re compiled or re copied to
the deployment directory that you have specified in the build.xml file. When you use build.sh the
first time, the make utility Ant will create the whole directory structure from scratch.
The build.xml file and the source code directories are organized in a way that the Servlet API
Specification V2.2 compliant Web application hierarchy is generated automatically. This
standard directory layout is shown in Figure 6.
When building the application, you may also specify an optional parameter to control the build
behavior (
$ ./build.sh [parameter]
). The available options are shown in the table below.
Option
Function
prepare
Generates the deployment directory structure.
clean
Removes the deployment home directory structure.
compile
The default; Compiles/copies the project to the deployment home.
javadoc
Generates the Java documentation.
all
Executes clean, prepare, compile, and javadoc consecutively to re build all.
dist
Generates the WAR file for the application; a Web archive is a compressed file that
contains the whole Web application in a single file, conforming to the Servlet API
Specification V2.2. The Web archive is used to easily distribute and deploy an
application. The dist command also generates a JAR file of the source code.
Table 4: Application Build Options
Eventually, you may wish to modify the provided build.xml file, for example to generate the Java
documentation in another directory, or to change the javac compiler settings (turn optimization
on, for example). The Apache Ant documentation explains the available XML tags and attributes
that make up the build script in the Ant reference documentation, which can be found here:
http://jakarta.apache.org/ant/manual/
.
40
Java Web Hosting Application Development Using Java Technologies Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |