![]() |
![]() ![]() |
![]() |
![]() |
![]() |
This product includes
software developed by the Apache Software Foundation (http://www.apache.org).
Specifically, the Ant Java[tm]-based build tool is included as part of Sun
ONE Application Server.
Benefits Of Using AntMany server side Java developers have found Ant to be an extremely useful tool for accelerating the development cycle associated with J2EE[tm] applications. Ant contains many built-in functions that relieve the burden of repetitive development tasks. As described in the Ant documentation, "In theory it is kind of like make without make's wrinkles". For more information about Ant, see: Ant Environment in Sun ONE Application Server 7In the Ant environment, build.xml files are analogous to a Makefiles. A build.xml file can define various targets that are used to compile and assemble a J2EE application. To use Ant with the sample applications provided as part of the application server, you need to ensure that your PATH includes the <install_dir>/bin directory of your application server installation. A simple wrapper script named asant(.bat) is located in this directory. No further set up is required. The following build targets
are represented in the build.xml
files accompanying the sample applications. The presence or absence of
a target depends on the type of J2EE application. Since the Java Pet Store
application from Sun Microsystems already includes build.xml
files, you might notice that not all of the following targets are represented
in the Java Pet Store sample application bundled with the application
server.
1. Set Up Your Environment
|
|
See the Creating Your Own Samples Environment section for a detailed description of the properties contained in the common.properties file. |
The Sun ONE Application Server 7 ships with custom Ant tasks that are part of the build environment for all samples. The following tasks are used in the sample build.xml files:
Custom Ant Task | Function |
sun-appserv-deploy | Deploys J2EE modules to the Sun ONE Application Server 7. |
sun-appserv-undeploy | Undeploys J2EE components from the Sun ONE Application Server 7. |
sun-appserv-admin | Enables arbitrary administrative commands and scripts to be executed on the Sun ONE Application Server 7. |
For more information about these Ant tasks and for a full list of the custom Ant tasks, please see the Administrator's Guide documentation.
The Sun ONE Studio 4, Enterprise Edition for Java IDE includes support for Ant build files. To use the IDE to execute the targets contained in the sample application build.xml files, you must ensure that the the JAR file containing the custom Ant tasks for Sun ONE Application Server 7 is added to the IDE's classpath.
1. Copy the file <install_dir>/lib/sun-appserv-ant.jar from the application server's installation directory to the <ide_install_dir>/modules/patches/org-apache-tools-ant-module/ directory and restart the IDE.
2. Mount a file system in the IDE that corresponds to a src/ directory of a sample application. For example:
<samples_dir>/jdbc/simple/src
3. Expand the build node under the src/ directory to list the targets available in the sample's build.xml file.
4. Double click the compile target to recompile the sample application.
5. Execute additional targets to experiment with other operations such as deployment and undeployment of applications.
In order to deploy a sample application, ensure that you modify the samples/common.properties file by setting the admin.password to the appropriate value.