Build Instructions - General
Check out the source
Firstly, check the source for Qpid out of our subversion repository:
https://svn.apache.org/repos/asf/qpid/trunk
Prerequisites
For the broker code you need JDK 1.6.0_18 or newer, or Java 1.7 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
Using Ant Eclipse task
QPID-3181 introduced a new Ant target 'eclipse' that can be used to auto-generate the Eclipse .project and .classpath files for Qpid. It generates separate Eclipse projects for each Qpid Java component (broker, common, client etc), sets up the classpaths and creates the inter-project dependencies.
It relies on http://ant-eclipse.sourceforge.net/ which is not included in the Qpid tree and must be downloaded/installed separately.
Proceed as follows:
1. Download the Ant-Eclipse task from http://ant-eclipse.sourceforge.net/. Version 1.0 or higher is required.
2. Unpack the Ant-Eclipse distribution and install the Ant-Eclipse task (ant-eclipse-*.jar) in Ant's /lib directory.
3. Run the normal Qpid 'build' target to create the Generated Code.
cd quid/java ant -f build.xml build
4. From the same directory, run the 'eclipse' target to create the .project and .classpath files.
ant -f build.xml eclipse -Declipse.container="org.eclipse.jdt.launching.JRE_CONTAINER" -Declipse.compilercompliance=6.0
The setting for -Declipse.container= varies from platform to platform. If unsure, it is best to check the setting from a .classpath from another Java Eclipse project you have on your machine. Look for the <classpath kind="con"../> element in the file.
5. In Eclipse in a new workspace, import the Qpid projects using the Import -> General -> Existing Projects into Workspace. Select the root qpid/java and let Eclipse discover all the projects beneath. In all, 21 Eclipse projects will be imported. After the import, Eclipse will report some build errors but these will be resolved by the next two steps.
6. The projects broker, common, client and broker-plugins-access-control rely on the Generated Code created in Step 3) to build properly. To create this dependency in Eclipse, use the "Linked Sources" to link each project to the corresponding directory containing the generated code. Linked Sources are created from the Java Build Path panel within the projects' properties.
In the broker project create a linked source to folder location build/scratch/broker/src/ called "scratch_src"
In the client project create a linked source to folder location build/scratch/client/src/ called "scratch_src"
In the common project create a linked source to folder location build/scratch/common/src/ called "scratch_src"
In the broker-plugins-access-control project create a linked source to folder location build/scratch/broker-plugins/access-control/src/ called "scratch_src"
7. The systests project, the src directory sometimes gets added twice to the build path. If this happens, manually remove both, and recreate just one.
8. Run a Project -> Clean/Build in the Eclipse workspace to rebuild Qpid. You should have no build errors. You are now ready to develop Qpid with Eclipse.
By default, the eclipse target will recreate the .project and .classpath files only if the build.xml is newer. You can override this behaviour and force regeneration by passing
the property -Declipse.updatealways=true on the command line.
Manually
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
perftests
- systests
- client
- broker
- common
- junit-toolkit
management/eclipse-plugin
- broker
- common
- management/common
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 Getting Started Guide 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.