Establishing a Build Process


The working directory structure contains everything required to build, package, and deploy the application to the local machine. The build process for a project refers to the scripts and tools used to perform these and other development and deployment steps in support of the overall development process. We recommend the use of the Apache build utility, Ant, to script and perform the build process in your WebLogic Server projects. There is a wealth of information available on Ant, including books, white papers, example build scripts, and the Ant project home page at http://ant.apache.org . Consistent with the intermediate to advanced nature of this book, we assume you have a basic knowledge of Ant and will concentrate on best practices related to its use in WebLogic Server development.

You should organize your build.xml build script based on the major steps required to build, package, and deploy the application. These steps or tasks generally fall into five categories: compilation and related activities, creating EJB archives, deploying locally, creating official deployment packages for promotion to test or production, and miscellaneous tasks used during development.

In each category you are likely to have multiple Ant targets , or high-level tasks, that perform a series of steps. In the build.xml file for bigrez.com , for example, the main Ant targets correspond to the categories in the manner indicated in Figure 13.3. We discussed many of these targets in detail in Chapters 5 and 8. Later in this chapter we ll describe the unit-testing process and discuss the purpose of the dist-test target shown in Figure 13.3 as a miscellaneous task. Additional targets in build.xml perform the compilation, packaging, and deployment steps for the Web services described in Chapter 15. These targets are not depicted in Figure 13.3.

click to expand
Figure 13.3:  BigRez.com build targets.

There is no single correct way to name the targets in your build script. The Ant utility doesn t mandate a particular naming scheme, and you ll find many different configurations in the open -source development community. Pick a scheme that makes sense for your application. Be sure target names are an accurate reflection of the tasks performed by the target. Don t have the compile target move compiled class files to the exploded application in the domain, for example. That s the role of a deploy or dist task in most cases.

Many build files also include an all or everything target that explicitly invokes all of the targets in the build file in the correct order. If you link the main targets appropriately using depends attributes this should not be necessary.

Best Practice  

Use the Apache Ant build utility to manage the build process for developer workstations and to create deployment archive files destined for test and production. Choose a consistent naming convention for your build targets, and keep each target focused on a single activity.




Mastering BEA WebLogic Server. Best Practices for Building and Deploying J2EE Applications
Mastering BEA WebLogic Server: Best Practices for Building and Deploying J2EE Applications
ISBN: 047128128X
EAN: 2147483647
Year: 2003
Pages: 125

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net