Archive

Posts Tagged ‘maven’

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.

Scala with Maven and IntelliJ IDEA

May 8th, 2009 1 comment

I have just started looking at the Scala language. So far I’ve been doing smaller examples of code, just using Emacs or simply the Scala interpreter. Now, starting a bigger project, I was thinking how to get started with a “real” development project. It proved amazingly easy, with the tools I’m used to from the Java-world.

Project structure and build – Maven

Plugins have been made to make Maven work smooth with Scala. A great page describing the details here.

The project can simply be created with Maven archetype, like this:

mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
  -DarchetypeGroupId=org.scala-tools.archetypes \
  -DarchetypeArtifactId=scala-archetype-simple \
  -DarchetypeVersion=1.1 \
  -DremoteRepositories=http://scala-tools.org/repo-releases \
  -DgroupId=mygroupid -DartifactId=myprojectid

The directory structure matches that of Java projects. Scala code goes in src/main/scala of course. All the regular commands just work (mvn test, mvn package, mvn install…).

Development environment – IntelliJ IDEA

I’ve been a big fan of IDEA for years, so using it for Scala is the obvious choice for me. Firstly get yourself a version 8.x of IDEA, then install the Scala plugin.

Since IDEA supports Maven pom.xml files as project descriptors, simply open the project created with Maven archetype. The only extra thing I had to do was add the scala-compiler.jar as a library. That’s about it. Most of my IDEA stuff seems to work right out of the box: ctrl-alt-F10 runs my code (both tests and main), shift-F6 lets me rename methods etc.

Super easy. All ready to go. Hopefully this is the start of my path away from the Java-language :)

Links used:

Tags: , ,