Build Instructions - General
Check out the source
Firstly, check the source for Qpid java out of our subversion repository:
https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/java
Prerequisites
For the broker code you need JDK 1.5 or later. You should set JAVA_HOME and include the bin directory in your PATH.
Check it's ok by executing java -v !
Build Instructions - Trunk (M2+)
Maven Build System
These details are currently being added
Install Maven 2
Firstly, you need to install Maven 2 from here).
You can find out how to set Maven up by following their quick guide.
Some of the relevant Maven targets (in Maven speak 'lifecycle phases') are as follows:
Phase |
Description |
---|---|
compile |
compile the source code of the project |
test |
test the compiled source code using a suitable unit testing framework |
install |
compiles & installs the package into the local repository & generates JAR files |
clean |
cleans up artifacts created by prior builds |
You can run the install phase but skip the tests by running:
mvn -Pfastinstall
to specify the fastinstall profile.
Build Qpid Java
To compile & install Qpid, cd into the java directory of your checkout and then:
mvn clean mvn install
If you wish to build an archive of Qpid for installing somewhere then:
cd distribution mvn
NB: executing Maven in the distribution directory does NOT force a clean build or a re-JAR, but uses the jars from your repository. You must be sure to execute a clean install in the java directory first (up one level from the distribution directory) to get a clean distribution. Best to check that the jars in your repository are current before building a dist!
Build/Debug Cycle
If you're changing code as part of a debugging effort and want to quickly rebuild and then run the broker for manual testing, you can use the following commands, starting in the top-level java
directory:
mvn -Pfastinstall cd distribution mvn assembly:directory
The first command above builds everything but skips the tests. The last command above builds the normal distribution but also creates a directory holding the contents of the Java bin assembly. You can run the broker directly from that directory by setting QPID_HOME
to point to it. For example, for the Qpid incubating 1.0 M2 snapshot version, the assembly directory resulting from running the final command above is:
target/qpid-1.0-incubating-M2-SNAPSHOT-java-bin
If you set the QPID_HOME
environment variable to the directory contained within the directory named above, i.e.:
target/qpid-1.0-incubating-M2-SNAPSHOT-java-bin/qpid-1.0-incubating-M2-SNAPSHOT
and add $QPID_HOME/bin
(UNIX) or %QPID_HOME%\bin
(Windows) to your PATH
, you can then run the broker by executing the qpid-server
script.
You can also control where the assembly directory is built via the qpid.targetDir
property, like this:
mvn -Dqpid.targetDir=/tmp/xyz assembly:directory
This will create the assembly directory and the various tar and zip files in directory /tmp/xyz
.
In summary, with QPID_HOME
set as described above, the edit/build/debug cycle becomes a matter of first rebuilding the appropriate artifacts, either from the top level or within the specific subdirectory for a single modified artifact, changing to the distribution
directory, and creating the assembly directory as described above. You can then run the broker via qpid-server
and perform your debugging, testing, etc.
Building Project Files
You can build project files for IntelliJ IDEA and Eclipse IDEs by executing the appropriate command in the java directory:
Command |
Result |
---|---|
mvn idea:idea |
Builds .ipr and .iml files with appropriate project settings for classpath etc |
mvn eclipse:eclipse |
Builds Eclipse project files with settings |
Build Instructions - M1 branch
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-module.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 java |
archive |
Generates all distribution archives for Qpid java |
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 java, 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 build-module.xml e.g. to compile the broker source, simply run the build target in the java/broker/build-module.xml file.
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.