Hi,

Jay SenSharma

Jay SenSharma

Some times we find that our is very large (few hundred Mbs) and we have made a small modification only to a single JSP or only few resources….In these kind of scenarios ..it is not great to redeploy the complete application…Rather we prefer to redeploy that perticular JSP again. Here is a Simple ANT script to do this:


Note: This Technique Is useful only for “Non-Archieved Applications”…means you can use Partial redeployment feature only with Exploded Applications …So this is suitable only for Development Environment …..because in Production we don’t change our Applications frequently.

build.xml

<project name="webservices-hello_world" default="deploy">
<property name="src" value="src" />
<property name="build" value="build" />
<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="deploy.target" value="AdminServer" />
<property name="war.name" value="VirtualDirWebApp" />
<property name="war.deploy.src" value="VirtualDirWebApp" />  <!-- this is an exploded Application -->

<path id="client.class.path">
<pathelement path="${clientclass-dir}"/>
<pathelement path="${java.class.path}"/>
</path>

<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy"/>

<target name="deploy">
<wldeploy action="deploy" name="${war.name}" source="${war.deploy.src}"
          user="${wls.username}" nostage="true" password="${wls.password}"
          verbose="true" adminurl="t3://${wls.hostname}:${wls.port}"
          targets="${deploy.target}" />
</target>

<target name="redeploy">
<wldeploy action="redeploy" name="${war.name}" deltaFiles="${war.deploy.src}"
          user="${wls.username}" password="${wls.password}" verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" >
          <files dir="${war.deploy.src}" includes="index.jsp"/>
</wldeploy>
</target>

<target name="undeploy">
<wldeploy action="undeploy" name="${war.name}" failonerror="false"
          user="${wls.username}" password="${wls.password}" verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>
</project>

While Deploying your application if you donot specify “nostage=true” then …while redeploying your application using deltaFiles….you need to specify the complete path:

<files dir=“——the path of Stage Directory of your Server Application” includes=”index.jsp”/>

Thanks

Jay SenSharma

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