5 Deploying and Packaging from a Split Development Directory

The following sections describe the steps for deploying WebLogic Server Java EE applications using the WebLogic split development directory environment:

Deploying Applications Using wldeploy

The wldeploy task provides an easy way to deploy directly from the split development directory. wlcompile provides most of the same arguments as the weblogic.Deployer directory. To deploy from a split development directory, you simply identify the build directory location as the deployable files, as in:

<wldeploy user="${user}" password="${password}"
   action="deploy" source="${dest.dir}"
   name="helloWorldEar" />

The above task is automatically created when you use weblogic.BuildXMLGen to create the build.xml file.

See Appendix B, "wldeploy Ant Task Reference," for a complete command reference.

Packaging Applications Using wlpackage

The wlpackage Ant task uses the contents of both the source and build directories to create either a deployable archive file (.EAR file), or an exploded archive directory representing the Enterprise application (exploded .EAR directory). Use wlpackage when you want to deliver your application to another group or individual for evaluation, testing, performance profiling, or production deployment.

Archive versus Exploded Archive Directory

For production purposes, it is convenient to deploy Enterprise applications in exploded (unarchived) directory format. This applies also to standalone Web applications, EJBs, and connectors packaged as part of an Enterprise application. Using this format allows you to update files directly in the exploded directory rather than having to unarchive, edit, and rearchive the whole application. Using exploded archive directories also has other benefits, as described in Deployment Archive Files Versus Exploded Archive Directories in Deploying Applications to Oracle WebLogic Server.

You can also package applications in a single archived file, which is convenient for packaging modules and applications for distribution. Archive files are easier to copy, they use up fewer file handles than an exploded directory, and they can save disk space with file compression.

The Java classloader can search for Java class files (and other file types) in a JAR file the same way that it searches a directory in its classpath. Because the classloader can search a directory or a JAR file, you can deploy Java EE modules on WebLogic Server in either a JAR (archived) file or an exploded (unarchived) directory.

wlpackage Ant Task Example

In a production environment, use the wlpackage Ant task to package your split development directory application as a traditional EAR file that can be deployed to WebLogic Server. Continuing with the MedRec example, you would package your application as follows:

<wlpackage tofile="\physicianEAR\physicianEAR.ear" 
           srcdir="\physicianEAR"
            destdir="\build\physicianEAR"/>
<wlpackage todir="\physicianEAR\explodedphysicianEar" 
           srcdir="\src\physicianEAR"
            destdir="\build\physicianEAR" />

wlpackage Ant Task Attribute Reference

The following table describes the attributes of the wlpackage Ant task.

Table 5-1 Attributes of the wlpackage Ant Task

Attribute Description Data Type Required?

tofile

Name of the EAR archive file into which the wlpackage Ant task packages the split development directory application.

String

You must specify one of the following two attributes: tofile or todir.

todir

Name of an exploded directory into which the wlpackage Ant task packages the split development directory application.

String

You must specify one of the following two attributes: tofile or todir.

srcdir

Specifies the source directory of your split development directory application.

The source directory contains all editable files for your project—Java source files, editable descriptor files, JSPs, static content, and so forth.

String

Yes.

destdir

Specifies the build directory of your split development directory application.

It is assumed that you have already executed the wlcompile Ant task against the source directory to generate the needed components into the build directory; these components include compiled Java classes and generated deployment descriptors.

String

Yes.