The following sections describe tools for deploying applications and standalone modules to WebLogic Server:
The wldeploy
Ant task enables you to perform weblogic.Deployer
functions using attributes specified in an Ant XML file. You can use wldeploy
along with other WebLogic Server Ant tasks to create a single Ant build script that:
See Using Ant Tasks to Configure and Use a WebLogic Server Domain for more information about wlserver
and wlconfig
. See Building Applications in a Split Development Directory for information about wlcompile
.
On Windows NT, execute the setWLSEnv.cmd
command, located in the directory WL_HOME\server\bin
, where WL_HOME
is the top-level directory of your WebLogic Server installation.
On UNIX, execute the setWLSEnv.sh
command, located in the directory WL_HOME/server/bin
, where WL_HOME
is the top-level directory of your WebLogic Server installation.
build.xml
by default). If you want to use an Ant installation that is different from the one installed with WebLogic Server, start by defining the wldeploy
Ant task definition:<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy"/>
wlserver
and wlconfig
tasks in the build script to create and start a new WebLogic Server domain. See Using Ant Tasks to Configure and Use a WebLogic Server Domain for information about wlserver
and wlconfig
.wldeploy
to deploy your application to one or more WebLogic Server instances or clusters. See
Sample build.xml Files for wldeploy and
wldeploy Ant Task Attribute Reference.build.xml
file by typing ant
in the staging directory, optionally passing the command a target argument:prompt> ant
The following example shows a wldeploy
target that deploys an application to a single WebLogic Server instance:
<target name="deploy">
<wldeploy
action="deploy" verbose="true" debug="true"
name="DeployExample" source="output/redeployEAR"
user="weblogic" password="weblogic"
adminurl="t3://localhost:7001" targets="myserver" />
</target>
The following example shows a corresponding task to undeploy the application; the example shows that when you undeploy or redeploy an application, you do not specify the source archive file or exploded directory, but rather, just its deployed name.:
<target name="undeploy">
<wldeploy
action="undeploy" verbose="true" debug="true"
name="DeployExample"
user="weblogic" password="weblogic"
adminurl="t3://localhost:7001" targets="myserver"
failonerror="false" />
</target>
The following example shows how to perform a partial redeploy of the application; in this case, just a single WAR file in the application is redeployed:
<target name="redeploy_partial">
<wldeploy
action="redeploy" verbose="true"
name="DeployExample"
user="weblogic" password="weblogic"
adminurl="t3://localhost:7001" targets="myserver"
deltaFiles="examples/general/redeploy/SimpleImpl.war" />
</target>
The following example uses the nested <files>
child element of wldeploy
to specify a particular file in the application that should be undeployed:
<target name="undeploy_partial">
<wldeploy
action="undeploy" verbose="true" debug="true"
name="DeployExample"
user="weblogic" password="weblogic"
adminurl="t3://localhost:7001" targets="myserver"
failonerror="false">
<files
dir="${current-dir}/output/redeployEAR/examples/general/redeploy"
includes="SimpleImpl.jsp" />
</wldeploy>
</target>
The following example shows how to deploy a J2EE library called myLibrary
whose source files are located in the output/myLibrary
directory:
<target name="deploy">
<wldeploy action="deploy" name="myLibrary"
source="output/myLibrary" library="true"
user="weblogic" password="weblogic"
verbose="true" adminurl="t3://localhost:7001"
targets="myserver" />
</target>
The following sections describe the attributes and child element <files>
of the wldeploy
Ant task.
The following table describes the main attributes of the wldeploy
Ant task.
These attributes mirror some of the arguments of the weblogic.Deployer
command. BEA provides an Ant task version of the weblogic.Deployer
command so that developers can easily deploy and test their applications as part of the iterative development process. Typically, however, administrators use the weblogic.Deployer
command, and not the wldeploy
Ant task, to deploy applications in a production environment. For that reason, see the
weblogic.Deployer Command-Line Reference in Deploying Applications to WebLogic Server for the full and complete definition of the attributes of the wldeploy
Ant task. The table below is provided just as a quick summary.
The format of the value of this attribute is
protocol :// host : port , where protocol is either http or t3 , host is the host on which the Administration Server is running, and port is the port which the Administration Server is listening.
|
||||
This attribute is valid only for unarchived deployments, and only for applications deployed using
stage mode. You must specify target servers when using this attribute.
Specifying the
deleteFiles attributes indicates that WebLogic Server should remove only thos files that it copied to the staging area during deployment.
|
||||
In this mode, the Ant task does not copy the deployment files to target servers; instead, you must ensure that deployment files have been copied to the correct subdirectory in the target servers' staging directories.
|
||||
This option immediately places the application into Administration mode without waiting for current HTTP sessions to complete.
|
||||
In this mode, the Ant task does not copy the deployment files to target servers, but leaves them in a fixed location, specified by the
source attribute. Target servers access the same copy of the deployment files.
|
||||
To avoid having the plain text password appear in the build file or in process utilities such as
ps , first store a valid username and encrypted password in a configuration file using the WebLogic Scripting Tool (WLST) storeUserConfig command. Then omit both the username and password attributes in your Ant build file. When the attributes are omitted, wldeploy attempts to login using values obtained from the default configuration file.
If you want to obtain a username and password from a non-default configuration file and key file, use the
userconfigfile and userkeyfile attributes with wldeploy .
See the command reference for
storeUserConfig in the
WLST Command and Variable Reference for more information on storing and encrypting passwords.
|
||||
Specifies the number of seconds before WebLogic Server undeploys the currently-running version of this application or module so that clients can start using the new version.
|
||||
See
Options for Securing Web Application and EJB Resources for more information on these security models
|
||||
Specifies whether the source file(s) are copied to the Administration Server's upload directory prior to deployment.
|
||||
Specifies that the deployment action (deploy, redeploy, stop, and so on) uses the existing lock on the domain that has already been acquired by the same user performing the action.
|
||||
Specifies the location of a user configuration file to use for obtaining the administrative username and password. Use this option, instead of the
user and password attributes, in your build file when you do not want to have the plain text password shown in-line or in process-level utilities such as ps .
Before specifying the
userconfigfile attribute, you must first generate the file using using the WebLogic Scripting Tool (WLST) storeUserConfig command as described in the
WLST Command and Variable Reference.
|
||||
Specifies the location of a user key file to use for encrypting and decrypting the username and password information stored in a user configuration file (the
userconfigfile attribute).
Before specifying the
userkeyfile attribute, you must first generate the key file using the WebLogic Scripting Tool (WLST) storeUserConfig command as described in the
WLST Command and Variable Reference.
|
||||
The wldeploy
Ant task also includes the <files>
child element that can be nested to specify a list of files on which to perform a deployment action (for example, a list of JSPs to undeploy.)
WARNING: | Use of <files> to redeploy a list of files in an application has been deprecated as of release 9.0 of WebLogic Server. Instead, use the deltaFiles attribute of wldeploy. |
The <files>
element works the same as the standard <fileset>
Ant task (except for the difference in actual task name). Therefore, see the Apache
Ant Web site for detailed reference information about the attributes you can specify for the <files>
element.