12 Replies Latest reply on Oct 24, 2006 9:37 AM by m.vysny

    Seam and maven projects

    dhartford

      I'm trying to find some resources on maven-built Seam web applications. I came across some stuff in the jboss-seam-tools package, but only in CVS

      org/jboss/seam/tools/output/maven/MavenWebProject.java

      What is the status of this and how can I get started evaluating/playing around with this?

      (would also be nice with Eclipse WTP of course ;-)

      thanks,
      -D

        • 1. Re: Seam and maven projects
          jgilbert

          I have been building Seam applications with Maven2 in my Taylor project.

          http://taylor.sourceforge.net

          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.

          • 2. Re: Seam and maven projects
            gavin.king

            Very cool! :-)

            • 3. Re: Seam and maven projects
              m.vysny

              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?

              • 4. Re: Seam and maven projects
                ge0ffrey

                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:
                /dvd
                /dvd/dvd-ear
                /dvd/dvd-ear/src/main/resources/META-INF/application.xml
                /dvd/dvd-war
                /dvd/dvd-ear/src/main/resources/WEB-INF/web.xml

                etc :)

                • 5. Re: Seam and maven projects
                  ge0ffrey

                  Make that last one:
                  /dvd/dvd-war/src/main/resources/WEB-INF/web.xml
                  of course

                  • 6. Re: Seam and maven projects
                    m.vysny

                    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.

                    • 7. Re: Seam and maven projects
                      hardy.ferentschik

                      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?

                      Cheers
                      Hardy Ferentschik


                      • 8. Re: Seam and maven projects
                        jgilbert

                        I have created the following maven2 site with all the jars I couldn't find else where.

                        http://taylor.sourceforge.net/maven2/

                        Here are links to sample pom.xml files:
                        http://taylor.cvs.sourceforge.net/taylor/taylor/bpm/
                        http://taylor.cvs.sourceforge.net/taylor/taylor/taylor-bpm-web/
                        http://taylor.cvs.sourceforge.net/taylor/taylor/taylor-bpm-app/

                        taylor-commons has JUnit TestSetup classes for initialize the EJB3 container and Seam in JUnit. Here are some samples:
                        http://taylor.cvs.sourceforge.net/*checkout*/taylor/taylor/bpm/src/test/java/net/taylor/worklist/service/TaskServiceTest.java
                        http://taylor.cvs.sourceforge.net/taylor/taylor/bpm/src/test/java/net/taylor/worklist/entity/TaskSeamTest.java

                        Here are samples of all the container config files:
                        http://taylor.cvs.sourceforge.net/taylor/taylor/bpm/src/test/resources/

                        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.



                        • 9. Re: Seam and maven projects
                          m.vysny

                          The dvdstore sample app is now at http://vyzivus.host.sk/site-files/dvdstore.zip, sorry for wrong link.

                          • 10. Re: Seam and maven projects
                            gavin.king

                            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

                            • 11. Re: Seam and maven projects
                              dhartford

                              Gavin,
                              There are a lot of pieces of Jboss EMS that many of us are interested in stronger maven support, not just Seam.

                              -Seam
                              -Embedded EJB3
                              -JBPM & Drools
                              -Remoting

                              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,
                              -D

                              • 12. Re: Seam and maven projects
                                m.vysny

                                 

                                "gavin.king@jboss.com" wrote:
                                (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.