Clover sources are organised into individually build-able modules.

Module layout

Each module lives in a separate top-level directory with its own build file. The rough template is:

/
+--<module-name>
|  +--etc                - miscellaneous resources like icons
|  +--src   
|  |  +-- main
|  |      +--java|groovy - source for the module
|  +--src
|  |  +--test
|  |     +--groovy       - test sources (unit testing, based on Groovy JUnit)
|  |     +--resources    - extra tests (integration tests, based on different frameworks)
|  +-- build.xml         - local build file for a module
|
+--common.xml            - contains version properties for all deliverables, common targets
+--build.properties      - paths to tools installed on developer's workstation
+--build.xml             - convenience build file that allows global build/test

Targets

The target names in build files for each module are prefixed by the name of the module, allowing modules to import other modules build files and express target dependencies in the normal Ant way. This naming convention is important for the operation of the build. Each module build.xml is designed to be location independent, so that imported targets can still work from importing build files. Because modules use import to express dependency this allows you to run the targets of any module up the dependency chain from the local module's build.

Every module needs the following minimum targets:

  • <module-name>.build
  • <module-name>.test
  • <module-name>.clean

"deliverable" modules are those that produce an end product, they have the following extra targets

  • <module-name>.pkg
  • <module-name>.prod

All modules import a common set of properties and targets from the file /common.xml. This file contains the version information for all deliverable packages (note that most modules import this indirectly, by importing other modules that in turn import /common.xml).

A global convenience build file /build.xml provides global build/test/report/clean targets, as well as exposing all targets from all modules.

Day-to-day development

  • If you are working on a particular module, you can either call build targets on the local module build file or from the global build file.
  • You can run tests locally using <module-name>.test or globally using global.test. In both cases the properties test.includes and test.excludes can be used to filter tests of interest.
  • All output from a module build is put under /<module-name>/target
  • There is also a global /target/dependencies directory which is used to cache third party libraries or a repackaged clover.jar

  • Before checking in, you should run at least clover-core.test and clover-ant.test
  • Some modules have a <module-name>.install convenience target to build and install the module.