Since I am playing with Maven and Seam, I had to manage to create a Seam 2.0 project which can be built with Maven (Seam 3.0 will be fully mavenized).
So here is what I found...
All you need to know is here:
http://seamframework.org/Documentation/IsThereAMaven2ProjectTemplateForSeamApplicationsThe first link (
http://kasper.eobjects.dk/2009/04/seam-ejbs-and-ear-packaging-in-maven.html) works out of the box and uses sub-projects for the different modules (and Eclipse is ok with that!) but I am a bit unsure regarding the test part.
It should work fine from the command line though.
The second link (
http://www.smies.com/blog/?p=30) seems to have the test part built in but I have not tested it yet. It also uses a flat structure for the project which is a bit less nice...
So after a bit of work, I improved Kasper's setup so that the project now has a persistence unit defined (remember to add a proper *ds.xml file in your deploy folder) and is also able to do some sort of hot-deploy. You can get the tar file
here.
For the hot-deploy part, I used something described here (
http://relation.to/Bloggers/FastAndIncrementalPackagingInJBossTools) which copies files automatically upon changes from your workspace to your deploy folder (or any other folder of your choosing) according to some rules so you can filter the files you do not want.
This JBoss Tools might be interesting in other cases as well...
So to have the hot-deploy working, I configured the Project archives like this:
- one exploded archive for the ear
- one exploded archive for the jar, exploded inside the ear above
- one exploded archive for the war, exploded inside the ear above, and with 2 file sets (one taking all from web/src/main/webapp (aka the xhtml files) and the other taking all from web/target/JMSeamExample-web-1.0 minus **/*.*html (basically only the libs)).
An explanatory picture can be found
here.
If one changes a Java class, the best is to right click on the project in Project archives and choose "Build full" to force a redeploy. Otherwise for xhtml files it happens by itself.
I know it is not has seamless as with the out of the box seam-gen integration but it is not too bad.