Getting started with JBoss Seam and Maven
07 Jun 2008For the past couple of weeks I’ve been doing a bit of early development work with Seam, it’s been fun but not without annoyance.
The project is green field which in one respect is quite nice because of the freedom it presents with regards to technology and architecture choices, but on the flip side you’ve actually got to investigate these choices and do all the general project plumbing (build management, etc.).
This initial post will deal largely with a couple of build infrastructure issues and solutions.
1. Maven
Fortunately the Seam Framework guys have been publishing Maven artifacts for awhile now.
Unfortunately, information on suitable project archetypes to use has been scarce. Initial searches turned up a few examples that were a number of years old and quite dated.
I eventually found JBSEAM-2371 which provided a useful starting point project.
I had to download the parent Seam pom and make modifications to the artifact name in order to get mvn site-deploy working appropriately. Something about the site plugin not being able to create directories with spaces in them.
Current Status: Everything is working. SeamTest-based integration tests are working (using embedded-jboss and hsqldb). Both the Maven site and IntelliJ IDEA plugins create the appropriate output. Artifacts are being deployed into JBoss 4.2.2.GA as part of the install phase using cargo.
The project layout is somewhat like the following:
api/app1-api api/app2-api seam/app1/app1-web seam/app1/app1-ejb seam/app1/app1-ear seam/app2/app2-web seam/app2/app2-ejb seam/app2/app2-ear
2. Static Analysis
Nothing too out of the ordinary here.
I’ve currently setup Checkstyle and FindBugs.
Configuration is stored in a separate top-level build-resources artifact (with xml configurations stored in src/main/resources) and included as a build extension in the project pom.
<build> ... <extensions> <extension> <groupId>a.b.c</groupId> <artifactId>build-resources</artifactId> <version>1.0-SNAPSHOT</version> </extension> </extensions> </build>
3. API Development
One of the key components of this project will be an API.
Rather than go the SOAP web services route, we’re strongly considering going RESTful with JAX-RS/JSR 311 helping us get there.
Bill Burke, Angry Bill of JBoss fame, has been actively developing RESTeasy, an implementation of JSR 311. It integrates fairly nicely with a Seam deployment (annotate your stateless EJBs and modify your web.xml) and allows you to easily expose a RESTful API backed by stateless session beans.
It should also be possible to go with the reference implementation of the JSR 311, Jersey, although I suspect that the JBoss implementation will eventually have a nicer integration for users of their stack.
JBoss AS doesn’t currently ship with a JSR 311 implementation so I had to install the jax-rs API and resteasy implementation jars into server/default/lib as part of a separate bootstrap process. This allowed me to mark the dependencies as provided.
Conclusion
Things are working and most of the grunt project infrastructure work is behind me. It’s been a good opportunity to get more familiar with Maven but now it’s time to get cracking on requirements definition and prototyping!
If you’re interested in working on a Seam-based application in the BioIT/Data management space, leave a comment and we’ll be in touch.