# Qpid Java Build How To

## Build Instructions - General

### Check out the source

Firstly, check the source for Qpid out of our subversion repository:

### Prerequisites

For the broker code you need JDK 1.5.0_15 or later. You should set JAVA_HOME and include the bin directory in your PATH.

Check it's ok by executing java -v !

If you are wanting to run the python tests against the broker you will of course need a version of python.

## Build Instructions - Trunk

Our build system has reverted to ant as of May 2008.

The ant target 'help' will tell you what you need to know about the build system.

### Ant Build Scripts

Currently the Qpid java project builds using ant.

The ant build system is set up in a modular way, with a top level build script and template for module builds and then a module level build script which inherits from the template.

So, at the top level there are:

File | Description
build.xml | Top level build file for the project which defines all the build targets
common.xml | Common properties used throughout the build system
module.xml | Template used by all modules which sets up properties for module builds

Then, in each module subdirectory there is:

File | Description
build.xml | Defines all the module values for template properties

### Build targets

The main build targets you are probably interested in are:

Target | Description
build | Builds all source code for Qpid
test | Runs the testsuite for Qpid

So, if you just want to compile everything you should run the build target in the top level build.xml file.

If you want to build an installable version of Qpid, run the archive task from the top level build.xml file.

If you want to compile an individual module, simply run the build target from the appropriate module e.g. to compile the broker source

### Configuring Eclipse

1. Run the ant build from the root directory of Java trunk. 2. New project -> create from existing file system for broker, common, client, junit-toolkit, perftests, systests and each directory under management 4. Add the contents of lib/ to the build path 5. Setup Generated Code 6. Setup Dependencies

#### Generated Code

The Broker and Common packages both depend on generated code. After running 'ant' the build/scratch directory will contain this generated code. For the broker module add build/scratch/broker/src For the common module add build/scratch/common/src

#### Dependencies

These dependencies are correct at the time of writting however, if things are not working you can check the dependencies by looking in the modules build.xml file:

    for i in `find . -name build.xml` ; do echo "$i:"; grep module.depends $i ; done

The module.depend value will detail which other modules are dependencies.

broker

- common

- management/common

client

- Common

systest

- client

- management/common

- broker

- broker/test

- common

- junit-toolkit

- management/tools/qpid-cli

perftests

- systests

- client

- broker

- common

- junit-toolkit

management/eclipse-plugin

- broker

- common

- management/common

management/console

- common

- client

management/agent

- common

- client

management/tools/qpid-cli

- common

- management/common

management/client

- common

- client

integrationtests

- systests

- client

- common

- junit-toolkit

testkit

- client

- broker

- common

tools

- client

- common

client/examples

- common

- client

broker-plugins

- client

- management/common

- broker

- common

- junit-toolkit

### What next ?

If you want to run your built Qpid package, see our for details of how to do that.

If you want to run our tests, you can use the ant test or testreport (produces a useful report) targets.