You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 42 Next »

Source

Firstly, check out the source from the subversion reporsitory or the git mirror.

Subversion

svn checkout http://svn.apache.org/repos/asf/qpid/java/trunk qpid-java

GIT

git clone git://git.apache.org/qpid-java.git qpid-java

Prerequisites

Java

The build requires a JDK version of 1.7.0 or later. You should set the JAVA_HOME environment variable and include its bin directory in your PATH.

Check it's OK by executing the following at your command prompt.

java -version

Maven

The build requires a Maven version of 3.0.0 or later.  You should set the M2_HOME environment variable and include its bin directory in your PATH.

Check it's OK by executing the following at your command prompt.

mvn --version
For full maven install reference visit Maven Installation Instructions.

Qpid Maven Structure

For complete reference and documentation on Maven please visit the following online resources.

Apache Maven Project

Maven: The Complete Reference by Sonatype

Project Object Model (POM)

Each Qpid java module has its own POM file (pom.xml) located in its root directory.

This file defines the modules version, dependencies and project inheritence as well as the configuration of the relative maven plugins specific to this module.  

At present we have 2 high level "parent" modules that serve as the grandparent and parent of all the java modules in the project.

 

POMArtifact NameLocationDescription

Qpid Parent

qpid-parent

NA

This is the high level POM that all Qpid modules ultimately inherit from.  

It itself is a child of the latest Apache parent POM and its main purpose is to initialise all of our default values, plugins and versions and set any global Qpid configuration.

It is versioned separatley and its release cycle is independent of that of the Qpid Java Project.

Java Build

qpid-java-build

pom.xmlThis is the primary build POM that can be used to build the whole Qpid Java project.  It defines all of the Java Qpid modules and sets all the default values, plugins, versions and configuration for the whole Java build.

Child Modules

qpid-*

 **/pom.xml

or

**/**/pom.xml

Each and every child module has its own specific POM file that specifies exactly what its dependencies are and any plugin configuration it needs.

Maven Commands

Here is a quick reference guide outlining some of the maven commands you can run and what the outcome will be.

Please visit Introduction To The Maven Lifecycle reference guide for full details on all the maven lifecycle phases.

CommandDescriptionNotes
mvn cleanremoves all the files created by the previous buildUsually means it deletes the contents of the modules */target/ directory.
mvn validatevalidates that the maven poms are all correct and that no config is missingUsefull to run when making build modifications to ensure consistency.
mvn compilecompiles the source code of the projectThis will verify that project dependencies are correct.
mvn testexecutes the unit testsShould not rely on code being packaged or deployed, only unit tests.

mvn package

packages the code into the its distributable formats (jar, war, zip etc)Each pom specifies what the distribution format is, default is POM.
mvn verifyverifies that the packaged code is validThis will run the integration and system tests.
mvn installinstalls the package into the local maven repositoryThis will result in the module being available, locally, as a depedency
mvn deploycopies the final artifacts to the remote maven repository for sharingThis would happen only when modules ready to be shared with other developers or projects
mvn site:stagecreates a staged version of the maven site with all the reports

Staging output defaults to the */target/staging/ directory

mvn jacoco:reportgenerates the code coverage report for the tests that have been executedTest output appears in the */target/site/jacoco/ directory

Maven Profiles

Maven profiles are used to allow set configuration to be enables easily at the command line using the -P option.

for e.g.

mvn verify -Pjava-mms.0-9-1

Please visit Introduction To Maven Profiles for full details on the use of profiles in a maven build.

Profile NameDescription
java-mms.0-10Test profile to use AMQP 0-10, the Memory Message Store and the Java Broker for system testing
java-mms.0-9-1Test profile to use AMQP 0-9-1, the Memory Message Store and the Java Broker for system testing
java-mms.0-9Test profile to use AMQP 0-9, the Memory Message Store and the Java Broker for system testing
java-bdb.0-10Test profile to use AMQP 0-10, the BDB Message Store and the Java Broker for system testing
java-bdb.0-9-1Test profile to use AMQP 0-9-1, the BDB Message Store and the Java Broker for system testing
java-bdb.0-9Test profile to use AMQP 0-9, the BDB Message Store and the Java Broker for system testing
java-dby-mem.0-10Test profile to use AMQP 0-10, the Derby In-Memory Message Store and the Java Broker for system testing
java-dby-mem.0-9-1Test profile to use AMQP 0-9-1, the Derby In-Memory Message Store and the Java Broker for system testing
java-dby-mem.0-9Test profile to use AMQP 0-9, the Derby In-Memory Message Store and the Java Broker for system testing
java-dby.0-10Test profile to use AMQP 0-10, the Derby Message Store and the Java Broker for system testing
java-dby.0-9-1Test profile to use AMQP 0-9-1, the Derby Message Store and the Java Broker for system testing
java-dby.0-9Test profile to use AMQP 0-9, the Derby Message Store and the Java Broker for system testing
java-json.0-9-1Test profile to use AMQP 0-9-1, the Json Configuration Store Derby Message Store and the Java Broker for system testing
java-json.0-10Test profile to use AMQP 0-10, the Json Configuration Store Derby Message Store and the Java Broker for system testing
cppTest profile to use AMQP 0-10 and the C++ for system testing
apache-releaseRelease profile for performing Apache software releases
dependency-checkDependency check to validate project licensing ahead of release
joramtestsProfile used to execute the Joram JMS test suite (more below).
tckProfile used to execute the JMS TCK (more below)

Configuring Eclipse

In order to allow your maven project to be viewed/edited in Eclipse IDE use the following commands to generate the IDE config files (*.classpath, .settings etc):

mvn eclipse:eclipse

and the following to delete the IDE config files:

mvn eclipse:clean

and this command to setup your workspace to use your maven repo:

mvn eclipse:configure-workspace -Dworkspace=/path/to/qpid/workspace

Please see the Maven Eclipse Plugin site for full details of this plugin.

Maven Build Output

By default the build output for a maven module will appear in the modules "target" directory:

for e.g. the broker core module output appears in:

broker-core/target

Depending on the goals specified in the last build, one or all of the following can be found in the "target" directory.

LocationDescriptionNotes
*/target/Packaged build artifactsJAR, WAS, ZIP etc as well as any release specific artifacts specified in assembly files i.e. release tars
*/target/surefire-reports/Logs from unit/system test and Surefile summaryLogs files generated by the tests (named TEST-<test-class>-<test-method>.txt). Surefire summary has an .xml extension.
*/target/qpid-broker/${project.version}/qbtc-test-config/Broker configuration used by the System testsBroker configuration used by the System tests
*/taget/site/Maven site outputMaven reports generated in HTML format i.e. test reports, code coverage etc
*/target/staging/The staged maven siteLocal attempt to generate the full maven site

The releaseable Client and Broker binary packages can be found in the following locations locally if required for testing.

Broker

broker/target/qpid-broker-VERSION-bin.tar.gz

Once you have this then follow the Java Broker installation instructions.

Client

client/target/qpid-client-VERSION-bin.tar.gz

Once you have this then refer to the JMS client documentation.

Example Maven Commands

Here are some example Maven build commands that you may find usefull.

Clean previous builds output and install all modules to local repository without running any of the unit or system tests.

mvn clean install -DskipTests

Clean previous builds output and installs all modules to the local repository after running all the tests using the Java BDB 0-10 profile

mvn clean install -Pjava-bdb.0-10

Perform a subset of the QA (int or sys tests) on the packaged release artifacts

mvn verify -Dtest=TestNamePattern* -DfailIfNoTests=false

Execute the unit tests and then produce the code coverage report

mvn test jacoco:report

Joram JMS Testsuite

The Joram JMS Testsuite is integrated into the Maven build but is disabled by default.  It allows the Joram JMS test suite to executed, using the specified Qpid JMS client, against the Java Broker.  The Java Broker must be running already.

The following clients are supported:

  • qpid-jms-client - Qpid Client AMQP 1.0
  • qpid-amqp-1-0-client-jms - the proof of concept Qpid Client AMQP 1.0 (development ceased 0.32)
  • jms-client  for AMQP protocols 0-8..0-10

To use the test suite, first configure the Java Broker to permit HTTP basic-authentication, then run the following command:

mvn -f joramtests/pom.xml integration-test -Djoramtests=<jms client identifier>

where <jms client identifier> is one of: qpid-jms-clientqpid-amqp-1-0-client-jmsjms-client-0-9jms-client-0-10.

The Maven failsafe plugin will run the tests.  Unit output is produced in joram-tests/target/failsafe-reports and the log from the client is written to joramtests/target/joramtest.log.

To run a particular test use the failsafe plugin property -Dit.test:

mvn -f joramtests/pom.xml integration-test -Djoramtests=qpid-amqp-1-0-client-jms  -Dit.test=ConnectionTest

JMS TCK

The configuration for the JMS TCK is integrated into the Maven build but the profile is disabled by default.  The JMS TCK itself is proprietary and must be provided by the user.   The Java Broker must be running and HTTP management available. The test suite will automatically set-up/teardown the JMS objects required by the TCK.

  • qpid-jms-client - Qpid Client AMQP 1.0
  • jms-client  for AMQP protocols 0-8..0-10

To use the test suite, first unpack the JMS TCK into a directory, then invoke in the following way:

mvn post-integration-test -Dtck=qpid-jms-client -f tck/pom.xml -Dtck.directory=/path/to/jmstck/

To run an individual test, use the tck.test system property.

mvn post-integration-test -Dtck=qpid-jms-client -f tck/pom.xml -Dtck.directory=/path/to/jmstck/ -Dtck.test=com/sun/ts/tests/jms/ee/all/sessiontests/SessionTests.java

 

 

  • No labels