Use Ant to automate tasks
To support using Apache Ant with Java 2 Platform, Enterprise Edition (J2EE) applications running on the appserver, the product provides a copy of the Ant tool and a set of Ant tasks that extend the capabilities of Ant to include product-specific functions. Ant has become a very popular tool among Java programmers.
Overview
Apache Ant is a Java-based build tool. In theory, it is similar to Make, but Ant is different. Instead of a model in which it is extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell commands, XML-based configuration files are used. These files reference a target tree in which various tasks are run. Each task is run by an object that implements a particular Task interface. By combining the following tasks with those provided by Ant, you can create build scripts that compile, package, install, and test your application on the appserver:
- Install and uninstall applications
- Start and stop servers in a base configuration
- Run administrative scripts or commands
- Run the EJB deployment tool
- Run the JavaServer Pages file precompilation tool
For more detailed information about Ant, refer to the Apache organization Web site.
Procedure
- To run Ant and have it automatically see the WebSphere classes, use the ws_ant command.
The ws_ant command is provided with the Apache Ant tool.
See the app_server_root/bin/ws_ant.bat|sh file for the Apache Ant tool.
- Use Ant tasks for deployment and server operation.
The Apache Ant tasks for the product reside in the Java package: com.ibm.websphere.ant.tasks. The API documentation for this package contains detailed information about all of the Ant tasks that are provided and how to use them.
See com.ibm.websphere.ant.tasks API documentation in the Reference section of the information center.
- Use Ant tasks for building application code by using the Application Server Toolkit (which is a CD included with WAS as a separately installable toolkit)
Note that this toolkit includes an Automated Deployment example "Example: Automated Deploy" for JACL scripted deployment of multiple application updates to multiple servers and clusters in a WebSphere ND cell.
Within the Application Server Toolkit product documentation, open the section Working with Ant. You can locate the topic by searching for Working with Ant, or from the navigation view, select Help > Help Contents > Application Server Toolkit > J2EE applications > Working with Ant.
- Use the Apache Struts framework to create an extensible development environment for your application, based on published standards and proven design patterns.
IBM WAS provides the Apache Struts JAR file in the install_root/optionalLibraries/Apache/Struts/1.1 directory of your product installation. If using Struts in your application or Application Server, configure a Shared Library that points to the Struts library JAR file.
The Struts framework provides the invisible underpinnings every professional Web application needs to survive. The core of Struts is a flexible control layer based on standard technologies such as Java Servlets, JavaBeans, ResourceBundles, and Extensible Markup Language (XML).
Struts encourages application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm. Struts provides its own Controller component and integrates with other technologies to provide the Model and the View. For the Model, Struts can interact with any standard data access technology, including Enterprise Java Beans (EJB) components, and JDBC. For the View, Struts works well with JavaServer Pages files, XSLT, or other presentation systems.
Manage shared libraries