Chapter 3. Building Projects from Source

Table of Contents

3.1. Source Tree Hierarchy
3.1.1. The 'main' module
3.1.2. The 'support' module
3.1.3. The 'testapp' module

Abstract

This chapter describes the general organization of the source code in any sister project, and provides general guidance on how to build sister projects from source. Follow the steps in this chapter if you want to build the sister projects from source, or want to contribute back to the sister projects.

So far as possible, the codebase for each sister project follows the same basic directory structure, though the modules in each and their implementation will vary of course. The instructions given here are general a guide, but you should also consult the developers' guides for each sister project for any additional details, and any artifacts that fall outside the standard directory structure. (For example, the Star Objects project itself supplies the corporate POM and a site template, the steps for which documented in Part IV, “Building and Deploying the Corporate Artifacts” of part three of this guide.)

3.1. Source Tree Hierarchy

Although the code in every sister project is different, they all (try to) follow the same general hierarchy:

trunk/
  main/               # main module, aggregates submodules
    pom.xml
    applib/           # application library (if any)
    documentation/    # users' and developers' guides
    xxx/              #
    yyy/              # modules specific to the sister project
    zzz/              #

  support/            # optional, built after main
    pom.xml           
    release/          # a consistent stack of dependencies for this release
    archetype/        # quick-start archetype (if any)

  testapp/            # optional, not released
    pom.xml

3.1.1. The 'main' module

The main module is a parent that aggregates the various submodules that make up the sister project:

  • the applib (if any) contains the application library. For example, Restful Objects defines an applib for client-side applications calling the RESTful web service;

  • the documentation, holding users' and developers' guides;

  • any further submodules that make up the application. For example, Restful Objects has a viewer module; JPA Objects has a module for an object store implementation.

The steps for building the main module for most sister projects will amount to little more than:

cd trunk/main
mvn clean install

If you want to build a single module, then use the '-pl' flag. For example:

cd trunk/main
mvn clean install -pl documentation

just builds the documentation.

Alternatively, in general it's also possible to cd into the appropriate directory and build from there:

cd trunk/main/documentation
mvn clean install

3.1.2. The 'support' module

The support module, if it exists, is another parent that is built after the main module. It aggregates submodules that to help developers use the sister project:

  • a release artifact, which defines (in <dependencyManagement>) a consistent set of artifacts. This can be used as a parent (or at least documents the set of dependencies that have been tested together);

  • an archetype artifact, which can be used for quick-starts. The archetype should be designed to work with the Naked Objects "claims" example. In general the modules created by running the archetype should use the release artifact.

The steps for building the support module for most sister projects will again amount to little more than:

cd trunk/main
mvn clean install

The reason that the support module is built after the main module is because it requires the main's submodules to be have released.

3.1.3. The 'testapp' module

The testapp module, if it exists, is used for testing. It should be built using the archetype, if there is one, and/or should use the release artifact as its parent.