I have been building Seam applications with Maven2 in my Taylor project.
The current version builds the ejb3 jar, war, and ear with one maven project. The next release will generate seperate jar, war, and ear projects for more flexibility.
Very cool! :-)
I converted the DVD Store demo to a Maven2 project, you may download it at http://vyzivus.host.sk/maven2-seam.html
However I was unable to run the testng tests in maven2. I tried to disassembly the hibernate-all.jar, jboss-ejb3-all.jar and thirdparty-all.jar onto separate libraries but I didn't know correct versions of libraries and all I got was some strange exceptions ;) So, is there a list of standard libraries that will make Seam run unittests?
The seam examples booking and dvd mix their ear, ejb and war configution files in the same directories: their ant script does some magic to extract the right ones for each artifact.
It woul be easier to distill a maven2 build from those example if their configuration files where split into different directories:
Make that last one:
The 'application.xml' file is generated by ear plugin so I don't have to put it in the src directory. The 'web.xml' file is in the dvdstore-war/src/main/webapp/WEB-INF/ directory as required by the war plugin. Please download http://vyzivus.host.sk/site-files/dvdstore.tar.gz and see for yourself.
ps: it seems that I used gzip two times to pack it... my fault! O:-) please use gzip -d dvdstore.tar.gz;tar -xvzf dvdstore.tar to unpack. I'll fix it in a few hours.
I am having my problems with maven build as well. I started out with this wiki page: http://wiki.jboss.org/wiki/Wiki.jsp?page=MavenBuildCreation. Unfortunately, the repository http://repository.jboss.com/maven2 does seem not to be up to date. It would be great if the repository would be always updated with the latest jar files. Is there any move within JBoss to 'formalize' the publishing of new artifacts into the maven repository?
I also found http://vyzivus.host.sk/maven2-seam.html and got finally an intial maven2 build up and running, but I am still not quite happy. The provided build examples (the JBoss ant build scripts as well the maven2 scripts under vyzivus.host.sk) seem to be to simplified. For example, as part of the build I would like to (re-)create the database schema and populte it with reference data. I used to do this with hbm2ddl which is part of hibernate tools. After a quite some searching I found a repository with containing this dependecny:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-tools</artifactId> <version>3.2.0.beta6</version> <scope>compile</scope> </dependency>
I tried then run hbm2dll using this plugin configuration:
<plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>hbm2ddl</id> <phase>test-compile</phase> <configuration> <tasks> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="maven.test.classpath" /> <hibernatetool> <ejb3configuration /> <hbm2ddl drop="true" create="true" export="true" outputfilename="doubleEspresso.ddl" delimiter=";" destdir="target" format="true" /> </hibernatetool> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>
I keep getting error messages along the line:
> javax.naming.NamingException: Local server is not initialized
I started to trace the code and I believe that the problem is actually in the ant EJB3ConfigurationTask. Basically there is a problem with initialising the dataSource specified in persistence.xml (I can actually generate the schema if I specify plain JDBC properties in persistence.xml, but I really want to keep the data source). So far I haven't found a work around for the problem.
I start wondering if Seam is really production ready. Yes the provided builds work, but for real life case I also need things like filtering, schema creation, dependency management... All these things seem quite unstable and under constant development.
What do other people think? Has anyone successfully used hibernate tools for schema generation with maven2? Does anyone have similar problems?
I have created the following maven2 site with all the jars I couldn't find else where.
Here are links to sample pom.xml files:
taylor-commons has JUnit TestSetup classes for initialize the EJB3 container and Seam in JUnit. Here are some samples:
Here are samples of all the container config files:
To load the database for testing I create an import.sql file in the src/test/resources directory and I use an in-memory hsql datasource.
If you guys want solid Maven support, then one of you is going to have to step up and work on it, and promise to maintain it. I can't because:
(1) I don't know Maven (nor is it something i especially care for)
(2) Seam releases are already a massive integration clusterfuck of incompatible/broken versions of different things, without me introducing another moving part
There are a lot of pieces of Jboss EMS that many of us are interested in stronger maven support, not just Seam.
-JBPM & Drools
Some of these already do exist at the jboss maven repo http://repository.jboss.com/maven2/, but some do not and many are not regularly updated.
Part of the problem is that these project's jars and the maven repo are part of the distribution piece which is (and should be) carefully controlled. So instead of asking for better Maven support for Seam, most of us are asking for better Maven support of JBoss products ;-)
The second piece, showing examples of using with Maven, is something many of us can help contribute to, but we need the jars already in place.
Gilbert over at the taylor project http://taylor.sourceforge.net/index.php/Overview has done a great job of showing what can happen once all the jars are in place in repos (not to mention the PIM/PSM tool he is working on is awesome!).
my two coppers,
(2) Seam releases are already a massive integration clusterfuck of incompatible/broken versions of different things
Isn't there some way to split hibernate-all, jboss-ejb3-all and thirdparty-all.jar into standard packages and name/version them? The project itself could be much better maintainable aswell.