Hi,

Jay SenSharma

Jay SenSharma

Form WLS 9.x onwards in Admin Console we have a Feature called as “Lock & Edit”. It has many advantages but Some Adminstrators always complaint that because of this feature they need to keep on click on this button before deploying Any Application on WLS Server ..then there are several pages in the process of Deployment through Admin Console…for testing when we want to keep on deploying Applications /redeploy and undeploy them. Like in Dev Environments..This Simple ANT script will save our lots of time.

I have a very simple ANT Script which i use most of the time for quick deployment/redeployment/undeployment.

Just have a look … it is ย good.

Step1). WhereEver you have placed your Jar/WAR/EAR file to be deployed on the Server Just Paste this “build.xml” file. Just change the Property values according to your requirement in the below file…
“build.xml”

<project name="webservices-hello_world" default="deploy">
<property name="wls.username" value="weblogic" />
<property name="wls.password" value="weblogic" />
<property name="wls.hostname" value="localhost" />
<property name="wls.port" value="7001" />
<property name="admin.server.name" value="AdminServer" />
<property name="deploy.target" value="ClusterNameABC" />
<!-- Here you can specify Either ClusterName, IndividualServerName Like "ManagedOne" or comma Seperated List of Managed/AdminServer -->
<property name="deploy.name" value="TestApp" />
<property name="deploy.source" value="TestApp.ear" />

<!-- Setting TaskDefinition -->
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
<classpath>
<pathelement location="C:/bea103/wlserver_10.3/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"
          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>

Step2). Whenever you want to deploy the Application Just Change the Properties according to your requirement.

Step3). Open a command Window and then run (setWLSenv.cmd or setWLSEnv.sh or setDomainEnv.sh or setDomainEnv.cmd)

Step4). To Deploy the Application move to the current directory where ever you have placed “build.xml” and “TestApp.ear” (Your Application) and then run

ant deploy

Step5). To Redeploy the Application

ant redeploy

Step6). To Undeploy the Application

ant undeploy

.

.

Thanks
Jay SenSharma

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.