Version 58

    If you want to create an Seam project and use it in Eclipse, you probably want to use seam-gen, discussed in Chapter 2 of the reference manual.  The rest of this page is left here for historical purposes!

     

    How to Create a Simple Seam Project in Eclipse from the Examples

     

    If you would like to create a simple project that uses Seam and can be tested with TestNG from inside Eclipse, without reference to Seam source code, hopefully you will find this helpful.

     

    Downloads & Installations

     

     

    Configuration

     

    There are certainly many ways in which you can create a working project;

    this is just one of them.  We will use the simple registration example

    as a starting point; once you have a working project you can then morph it

    for your own purposes.

     

    • create a new Eclipse Java project, which we'll call seam-registration here

      • create a new project in your Eclipse workspace

      • set compiler compliance for the project or default for all of Eclipse to 5.0 or higher

      • create separate source and output folders, which will default to src and bin

    • create doc, doc/html, lib, lib/ext, lib/seam, resource, test, and view folders in seam-registration.  Only create the test folder if you want to separate your test source from your real source.

      • also create META-INF and WEB-INF folders under resource

    • copy jboss-seam-debug.jar, jboss-seam-ui.jar, and jboss-seam.jar from the directory in which you installed seam to the lib/seam folder -- you will later be able to create archives including them from there

    • copy all the JAR files from lib (from the directory into which you installed seam) to your lib/ext folder

    • copy emma.jar and emma_ant.jar from the Emma distribution to your lib/ext folder

    • edit the Java Build Path properties for seam-registration

      • the src folder should already be listed as a source folder, add the resource and test folders

      • in libraries, add all of the various JAR files from your lib/seam and lib/ext folders

    • from the directory into which you previously installed Seam, copy all the files from .../examples/registration/resources to your project's resource folder, making sure that the relative directory structure using META-INF and WEB-INF is maintained

    • also copy all files that end in .properties or .xml from src/main, examples/registration/src, examples/registration/resources, and embedded-ejb/conf to your resource folder

    • copy the source tree from examples/registration/src to your src folder.  If you prefer your tests to be separate from the rest of your source code, then create folders org/jboss/seam/example/registration under your test folder, move the contents of src/org/seam/example/registration/test (i.e. RegisterTest.java and testng.xml) there, and fix their package references (i.e. remove the .test at the end).

    • copy the source tree from examples/registration/view to your view folder

    • place an empty file named seam.properties in your src folder

    • from the attachments for this Wiki page:

      • copy src-overview.html to src

      • copy test-overview.html to test

      • copy seam-registration.properties and build.xml to seam-registration

      • copy index.html and seamproj.css to doc/html

    • set jboss.home in build.xml per the installation on your computer

     

    At this point, Eclipse should not be complaining about any errors in your source.

    This is not the only way to start a Seam project, but it's one that works.

     

    What you can do

     

    This was a lot of work, but you should now have a project where:

    • you can run TestNG tests by right-clicking on the appropriate testng.xml file

    • run the ant all target to get

      1. an EAR file of the project

      2. javadoc for both source and tests in doc/html

      3. tests run with a report in doc/html

      4. code coverage report in doc/html

    • run the ant deploy target to deploy your application to JBoss

    • run the ant undeploy target to undeploy your application from JBoss