Hi Guys
This post is information about the Ant Deployment
ant - Another Neat
Tool
ant – is a build and
deploy tool that is used to create and deploy archive files.
Welogic internally provides an ant task “wldeploy” that can
be used in ant scripts to automate deployment.
This wldeploy internally calls weblogic.Deployer
ant deployment depends on the configuration file called
build.xml
the structure of build.xml file
Project -à
Properties -- > Each property has a name & a
value for that property.
These
properties can be defined as per the requirements and values need to assigned.
taskdef à the ant task
“wldeploy” classfile will be defined in the build.xml file
targets à
targets are blocks of code that take certain action. For Eg. Deploy
Build.xml file
sample:
<project name="webservices-hello_world"
default="deploy">
<property name="wls.username"
value="wlsadmin" />
<property name="wls.password"
value="wlsadmin" />
<property name="wls.hostname" value="192.168.128.9"
/>
<property name="wls.port"
value="20001" />
<property name="admin.server.name"
value="Admin" />
<property name="deploy.target"
value="softCluster1" />
<!-- Here you can specify Either ClusterName,
IndividualServerName Like "ManagedOne" or comma Seperated List of
Managed/AdminServer -->
<property name="deploy.name"
value="jsf" />
<property name="deploy.source"
value="deploy/jsf-1.2.war" />
<!-- Setting TaskDefinition -->
<taskdef name="wldeploy"
classname="weblogic.ant.taskdefs.management.WLDeploy">
<classpath>
<pathelement
location="/home/durgasoft/bea10.3.0/wlserver_10.0/server/lib/weblogic.jar"/>
</classpath>
</taskdef>
<!-- Deploying Applications -->
<target name="deploy">
<wldeploy action="deploy"
name="${deploy.name}"
source="${deploy.source}"
user="${wls.username}"
nostage="true"
password="${wls.password}"
verbose="true"
library="true"
adminurl="t3://${wls.hostname}:${wls.port}"
targets="${deploy.target}" />
</target>
<!-- Redeploying Applications -->
<target name="redeploy">
<wldeploy action="redeploy"
name="${deploy.name}"
user="${wls.username}"
password="${wls.password}"
verbose="true"
adminurl="t3://${wls.hostname}:${wls.port}"
targets="${deploy.target}" />
</target>
<!-- Uneploying Applications -->
<target name="undeploy">
<wldeploy action="undeploy"
name="${deploy.name}"
failonerror="false"
user="${wls.username}"
password="${wls.password}"
verbose="true"
adminurl="t3://${wls.hostname}:${wls.port}"
targets="${deploy.target}" />
</target>
</project>
After the build file is configured properly, the individual
targets can be invoked.
Invoking the ant
targets:
1) ant ( with out any arguments , will invoke the
default target on the first line of build.xml)
2) ant
deploy -- will invoke the “deploy” task
3) ant
undeploy -- will invoke the “undeploy”
task
4) ant
redeploy -- will invoke the “redeploy “
task
if you have to invoke the ant deploy with a different
configuration file , other than build.xml , then
ant –f
<config-file-name> b.xml
No comments:
Post a Comment