Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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/Image Added 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/Image Added. 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.

No Format

cd quid/java
ant -f build.xml build

4. From the same directory, run the 'eclipse' target to create the .project and .classpath files.

No Format

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:

...

  • client
  • management/common
  • broker
  • broker/test
  • common
  • junit-toolkitmanagement/tools/qpid-cli

perftests

  • systests
  • client
  • broker
  • common
  • junit-toolkit

management/eclipse-plugin

  • broker
  • common
  • management/common

...

  • commonclient
  • management/

...

  • common
  • client

management/tools/qpid-cli

  • common
  • management/common

management/client

  • common
  • client

integrationtests

  • systests
  • client
  • common
  • junit-toolkit

...