Creating an ear with version for Weblogic using Maven

2010-11-12 11:35:28 +0100

Using the ear plugin of Maven 2 creating an ear is very easy. The produced ear follows the JEE spec, so you can normally use it in any application server.
I'm using the ear plugin as well, in my case to be used for Weblogic 9. Weblogic has a feature that allows you to update applications on the fly using the Deployments, update command. However, to be able to use that feature well, the MANIFEST file of the ear has to include a Weblogic specific version field called WebLogic-Application-Version, with a unique version for each ear you'd want to include. Without the version number, Weblogic will list the application twice in the weblogic administration console.

Adding a custom manifest entry is quite easy. Just add an entry to the configuration of the Maven 2 ear plugin, as shown in the example below:

<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<WebLogic-Application-Version>${project.version}</WebLogic-Application-Version>
</manifestEntries>
</archive>
...
</plugin>

This will cause the Manifest file to contain an entry WebLogic-Application-Version containing the current version of your Maven project.
However, this wasn't enough for me: I'm sometimes modifying and recreating the ear multiple times per day during development. The maven project version remains the same, which means Weblogic won't see my new development ear as a new version.
The solution is to include a timestamp in the version as well. By default, Maven doesn't include a timestamp. Fortunately there's Stackoverflow with the answer: there's an external plugin called buildnumber-maven-plugin that allows you do that.
For my weblogic specific entry I added the following to the pom.xml file:

<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<configuration>
<format>{0,date,yyyyMMddHHmmss}</format>
<items>
<item>timestamp</item>
</items>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>

The above entry will make a variable buildNumber available during build containing a timestamp.
The maven ear configuration becomes:

<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<!-- Buildnumber property is generated by buildnumber-maven-plugin,
see above -->
<WebLogic-Application-Version>${project.version}_${buildNumber}</WebLogic-Application-Version>
</manifestEntries>
</archive>
...
</plugin>

After installation in Weblogic using the admin console, weblogic now lists the version number, date and time after I install my ear. Upgrading the application won't result in two applications being listed.



Read more

Google buys Instantiations

2010-08-11 21:51:12 +0200

A while a go I used to do Swing development, and I sometimes used the tool of Instantiations to develop my GUI. I quite liked the tool.
Before that I used Visual Basic and Visual Studio frequently. I never fully understood why people would fiddle so much with pixels, stylesheets, colors etc when you could just design your GUI visually.
Well, Instantiations has GWT design tool as well. I recently tried it out very shortly. The tool looked very nice.
I just recently Google bought Instantiations. Will this mean developer productivity in frontend development is cool again?

Read more

Archive

subscribe via RSS