Friday, August 8, 2008

Seam and Maven

A while back I mentioned that I'd post a Maven project that would make building Seam applications with Maven a little easier. Here it is, I've got three projects actually. For the impatient, you can see all the projects over here on Google code. The three projects I created are:
  1. basic-settings, this is a parent pom project to define the JBoss repository, set your compiler to Java SE 5 (Maven defaults to Java SE 1.3), and sets some defaults for the Maven eclipse plugin.
  2. seam-dependencies this project defines all your Seam dependencies. You will use this as a dependency in your Seam project. This defines the Hibernate and Seam JARs you need to get your Seam application working.
  3. seam-example this is a sample application that uses both basic-settings and seam-dependencies, to illustrate how to put it all together. This application is a simplified version of the JPA-booking example that comes with Seam.
These projects do not use Java EE in any way, so there isn't even a JBoss embedded dependency. My reason for doing this was to make building and deploying an application as easy as possible. To get to the projects, you need to download the the source from my Google code project, which you can find here, once at the project page, click the "Project" tab and that will tell you how to check out the code. Now that you've got the code checked out, run mvn install for these projects:
  1. basic-settings
  2. seam-dependencies
With everything installed, you can try out the seam-example project. To run the project, use the Maven Jetty plugin, like this:
cd seam-example
mvn jetty:run
You can access the app from port 9090, using this URL: http://localhost:9090/seam-example I also did a Seam presentation at the July 2008 UJUG meeting. You can see the presentation here.