Skip navigation.
Downloads | Product Documentation | Support

Avitek Medical Records Development Tutorials

# Developing the MedRec Applications

# Tutorial 13: Compiling the Entire MedRec Project

Previous tutorials explained how to compile, build, and deploy parts of individual MedRec applications. In this tutorial, you compile and build the entire MedRec application suite using the project-level `build.xml` file. Compiling the entire application suite is necessary to deploy all components on your system and verify that MedRec is running and usable.

The tutorial includes:

- Prerequisites
- Procedure
- Best Practices
- The Big Picture
- Related Reading

# Prerequisites

Create the project directory using the instructions in Tutorial 5: Creating the MedRec Project Directory.

# Procedure

The project directory contains a master `build.xml` script that compiles and stages all of the MedRec applications in the correct order. To run this script:

1. Open a command shell and set the development environment:

>     prompt> c:\bea\user_projects\domains\MedRecDomain\bin\setDomainEnv.cmd

2. Move to the `src` subdirectory of the MedRec project directory:

>     prompt> cd c:\medrec_tutorial\src

3. Use the Ant command to execute the master `build.xml` script with the `deploy.dev` target:

>     prompt> ant deploy.dev

The build process displays messages indicating the progress for each application. The entire build process take approximately 2 to 5 minutes to complete, depending on the speed of your computer. The script should complete with the following message:

>     build:
>          [echo] ####   E N D   M E D R E C   ####

>     BUILD SUCCESSFUL
>     Total time: 2 minutes 22 seconds

# Best Practices

- Not all projects require a master build script. If you are creating only a single Enterprise Application or a single component of an Enterprise Application, a single `build.xml` file using the WebLogic Ant tasks will suffice.
- If your project requires multiple Enterprise Applications to be compiled in a particular sequence (because of shared utility classes or Web Services dependencies), use a master `build.xml` file at the source level to iterate through each application's `build.xml` files.

# The Big Picture

The MedRec application suite has many dependencies that require coordination during the build process. When you run the master build file, the following events occur:

1. The contents of `startBrowserEar` and `initEar` are compiled using the `wlcompile` task.
2. The contents of the `security` directory are compiled using the `javac` task.
3. The contents of `common` are compiled. The `common` directory contains the Java source code for several kinds of objects used by different MedRec applications:

- Utility classes—constants used throughout the application suite, exceptions, factories, and the `ServiceLocator` class. Servlets in the Web Tier of the MedRec application suite use `ServiceLocator` to lookup generic services such as Enterprise JavaBeans.
- Value objects—classes that represent data passed between tiers of the MedRec suite.
- Action classes—classes used by the struts framework to control page flow in the Web tier of the MedRec suite.
- JavaBeans—component beans used in the Web tier.

4. The `medrecEar` Enterprise Application is compiled. Although `medrecEar` uses the split development directory structure and the WebLogic Ant tasks in the build script, the application has several internal dependencies that are hard-coded in its `build.xml` script, using the `include` and `exclude` options to `wlcompile`.
5. The `physicianEar` application is compiled. The Web Service clients in this application that invoke the Web Services of both the `physicianEar` and `medrecEar` applications are generated from the `.wsdl` files that were previously generated into the `build` directory by the `jwsc` Web Services Ant task.
6. The MedRec application suite client applications, located in the `clients` directory, are compiled.

The `deploy.dev` target of the master `build.xml` file takes an additional step of packaging up the contents of the `build` directory for each application (`initEar`, `medrecEar`, and so on) and creating an exploded directory for each application in the `dist` directory. These exploded directories can be deployed to WebLogic Server in the standard way, outside of the split development directory framework. The next tutorials in this suite (Tutorial 14: Packaging MedRec for Distribution and Tutorial 15: Using WLST and the Administration Console to Deploy the MedRec Package for Production) go into more detail.

# Related Reading

- Compiling Applications Using wlcompile in Developing Applications with WebLogic Server
- Building Applications in a Split Development Directory in Developing Applications with WebLogic Server
- Overview of WebLogic Server Application Development in Developing Applications with WebLogic Server
- Apache Ant in Developing Applications with WebLogic Server