Building Seam with Maven 2

March 26, 2008 at 7:03 pm | Posted in Build, Java, Software Development | 5 Comments
Tags: , , , , , ,

JBoss Seam gives you a great build support if you want to go with Ant. But what about Maven 2? There doesn’t seem to be a lot of documentation about it. Here’s how I got it running. First of all you need to create a multi-module project. Maven 2 requires to have a POM for every artifact you want to build. What you need to set up is one project (through a directory) per artifact. The book “Better Builds with Maven” describes this procedure very well. After setting it up you should have something similar to this:

 - pom.xml
 |- ear
 |  - pom.xml
 |- ejb
 |  - pom.xml
 |- war
 |  - pom.xml

WAR will hold your JSF application files, EJB contains all EJB-related definitions and EAR ist just another project for building the enterprise archive. Each project will have their own POM file. On top of that you will have a parent POM which allows you to build all modules. In your parent POM define the Seam parent POM for usage:


You find the parent POM in the JBoss repository:

      <name>JBoss Repository</name>

Furthermore, you need to define your sub-modules (ear, ejb, war) as dependencies and modules. Add the JBoss Seam libraries you need. Moreover, don’t forget to set JDK >= 1.5 to build your code. Once you set up your project’s parent POM you’re ready to work on the module POMs. The only thing you have to do for the module POMs is to use your project’s parent POM and define the dependencies you need. For the EAR artifact you can use the Maven EAR Plugin to generate application.xml and jboss-app.xml. For a full code example have a look at the DVDStore Seam example build with Maven 2.



RSS feed for comments on this post. TrackBack URI

  1. thanks for the leads, but for a maven beginner like me it’s a bit too fast :-).
    You give a link to “DVDStore build with maven” but this example doesn’t include the seam parent artefact in main pom.xml and if the ear, ejb and war modules are well define as module they are not define as dependencies in this same pom.xml.
    I guess this example is a bit outdated (2006) so how would you correct it to make it fit today requirement ?

  2. Antoine,
    I had a look at the example again. You’re right. The example parent POM does not use the JBoss Seam root POM. They define a list of Seam JARs in the dependencies list instead. Using the Seam root POM helps you to avoid that.
    To define the sub-modules add them as modules:


    If you want to make sure that you use a specific version for your sub-modules you can enforce that in the dependenyManagement section (this is optional):


    An up-to-date resource to have a look at is the source code of “Seam in Action”. There’s one example project that uses Maven 2 to build it:

    Hope this helps.

  3. There is a new article by SEAM:

  4. checkout for a simple/empty j2ee seam project.

    took me quite a time to get it running.

    hope its helpful.


  5. Very nice post. I just stumbled upon your weblog and wanted to
    say that I have truly enjoyed browsing your blog posts. In any case I will be subscribing to your rss feed and I hope you write again very

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at
Entries and comments feeds.

%d bloggers like this: