Appendix A. Using the Maven Archetype

Table of Contents

A.1. Obtain the Claims Application
A.2. Set up a Relational Database
A.3. Run the JPA Archetype
A.4. Update the Existing Project's Classpath
A.4.1. Parent Module
A.4.2. Fixture Module
A.4.3. DOM Module
A.4.4. JDBC Drivers
A.5. Update the Configuration
A.6. Update the Domain Classes
A.7. Build the Schema
A.8. Install the Fixtures
A.9. Run the Application

Typically we advise that you don't integrate your domain model through to a relational DBMS in the early exploration/prototyping stages of development, because it's then easier to refactor and rework the model as your understanding of the complexities of the domain deepens. During this time, just use the in-memory object store and use fixtures to populate the object store for demoing. (You might also want to check out the FitNesse integration provided by the Tested Objects sister project).

However, there will come a point (eg after a couple of iterations) when the domain model is stabilizing. At this point you'll want to start integrating your new/updated domain objects into an RDBMS. The JPA Objects' Maven archetype is designed to help you complete this integration work.

When run the archetype creates a parent module along with some child modules, the idea being that you incorporate these modules into your own parent module (by editing the <modules> element). However, because most of the complexity involved is in adding the JPA annotations, what the archetype also does is supply examples of annotated domain objects for the "claims" applications that ships with Naked Objects. What you might therefore want to do is to gain experience by running the Maven archetype against this claims application. When you've seen how it works, you can run it again for your own application.

The following sections provide a workthrough of how to run the Maven archetype and show how to get the claims application running with it.

A.1. Obtain the Claims Application

In this walk-through we want to see how the example domain objects and repositories for the "claims" application can be used. So, first we should load up this "claims" application.

If you haven't done this previously, go to Naked Objects' Sourceforge project and download the nakedobjects-4.0.x-for-maven.zip archive. Unzip this to a convenient location. The parent module pom.xml application is in ~/examples/claims.

In Eclipse (with m2eclipse installed, see Section 1.2, “Prerequisites”), see the starobjects developers guide if required), switch to a new workspace, and then import the "claims" application using File > Import > General > Maven Projects. When done you should end up with 6 projects (claims, claims-commandline, claims-dom, claims-fixture, claims-service and claims-webapp).

Before continuing, check that you can run up the application using the DnD viewer or the HTML viewer, using the .launch scripts in claims-commandline project's eclipse_launch folder.