Home > English > WebLogic Production Redeploy version with Maven

WebLogic Production Redeploy version with Maven

Later versions of WebLogic support the notion of Production Redeployment which is pretty sweet as it lets you deploy new versions of your application rather transparent without stopping anything. This means users can access the application while deployment is running and will automatically be transferred to the new version when it’s ready.

The only thing you really need to ensure is that the deployment unit (war, ear..) contains a property Weblogic-Application-Version in the MANIFEST.MF file.

We wanted to have Maven automatically extract the latest build-number from Subversion and append this as the Weblogic-Application-Version property. Combining the buildnumber-maven-plugin and maven-war-plugin does the trick:

<build>
 <plugins>
  ...
  <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>buildnumber-maven-plugin</artifactId>
   <executions>
    <execution>
     <phase>validate</phase>
     <goals>
      <goal>create</goal>
     </goals>
    </execution>
   </executions>
  </plugin>
  <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <configuration>
    <archive>
     <manifestEntries>
      <Weblogic-Application-Version>${buildNumber}</Weblogic-Application-Version>
     </manifestEntries>
    </archive>
   </configuration>
  </plugin>
  ...
 </plugins>
</build>

The buildnumber-maven-plugin extracts the SVN build-number and sets it in the buildNumber variable. This it used in maven-war-plugin to update the manifest.

  1. Leif John Korshavn
    May 27th, 2009 at 19:39 | #1

    Cool tip!
    While developing web applications, hotdeploy is incredible useful for reducing the code-compile-test roundtrip. But what is the current status when it comes to hot-swapping applications in the production environment? In my experience, nobody in the operator division actually dare doing that. Are you actually using hotdeploy in production anywhere?

    By configuring deploy to production with Maven, are the developers doing the deploy, or have you introduced Maven as a tool for the operators/administrators?

  2. May 27th, 2009 at 20:13 | #2

    We’re not actually deploying with Maven. We only use Maven to build the war-file, with the tip above to get the correct version number for WebLogic inserted in MANIFEST.MF. Sorry if that was confusing in the original post.

    Deployment is done using WLST from Hudson in dev and test environments. In production the application is deployed manually from the console I think (we’re not responsible for the production environment).

    However, we are using the hot-swapping deployment in production. Usually we still deploy “after hours” in case something goes wrong, but the application is never down. We have also on a few occasions deployed during daytime with this technique when there has been minor (but critical) changes to the application. It seems to work fine :)

    The way it works is that the new application is deployed side-by-side with the old one. When the new app is up and running, new users are switched over to this and the old app is “retired” and can be deleted. And as I stated above the feature actually works.

  1. No trackbacks yet.