Archive

Posts Tagged ‘redeploy’

WebLogic Production Redeploy version with Maven

May 26th, 2009 2 comments

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.