Mavenising seam projects [ part 1 ].

Seam [1] is a  very powerful framework for developing java EE web-based applications. It is the only java framework which glues all the tiers of a typical java EE web application together. It is no surprise that many seam features like using EJB 3.0  (for seam any pojo which is a seam component) directly as JSF backing beans, declarative scoping and conversation scope  has been included in the new Contexts and Dependency Injection for Java EE 6 (CDI) also known as JSR 299 [2].  JSR 299 combines best features of seam, Google Guice [3] and Spring [4]. Seam also has tons of other features which make it a very useful framework to learn for any Java developer. Seam by default uses ant. The seam-gen tool creates an ant project and itself is a wrapper to different ant targets.

Maven on the other hand is emerging as the de-facto building tool for java. As I have already mentioned before, maven gives you a very good overview of your project and you are not lost in minor details. Those details are automatically taken care of. With seam projects, maven is especially useful because you know which dependencies are needed.

When I started learning seam, by reading the very popular book Seam in Action by Dan Allan [5], I had already switched to maven for all my projects. I decided to mavenise the examples of the book. There are many such projects. The seam documentation also points to the seam-maven-refimpl project [6] which provides a nice template for any seam project. As I wanted to find out how the maven implementation a seam project differs from that of a standard java EE project first hand, I didn’t use the template provided by this project. I just started with a standard java EE project and started adding seam dependencies to it, until I had a working example.

The implementation  can be found here. Please feel free to point out any mistakes or suggest improvements to th code.

I have also tried to convert the first examples of the book Seam 2.x Web Development by David Salter [7]. These examples are very simple i.e. without persistence, richfaces etc, although they use state less session beans.

Here I will discuss the Open18 example from the Seam In Action book in detail.

Here is the pom file of the main parent project which is no different from an ordinary Java EE project. The only seam specific thing is the jboss repository entry at the end.

<?xml version="1.0" encoding="UTF-8"?>
        <!-- hibernate dependencies with provided scope -->

  		JBoss Repository


  1. Seam
  2. Contexts and Dependency Injection in Java EE 6 (JSR 299)
  3. Google Guice
  4. Spring framework
  5. Seam in action
  6. Seam maven reference implementation
  7. Seam 2.x Web Development