qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Qpid > Qpid Java Build How To
Date Mon, 16 May 2011 19:36:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/21/_/styles/combined.css?spaceKey=qpid&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/qpid/Qpid+Java+Build+How+To">Qpid
Java Build How To</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~robbie">Robbie
Gemmell</a>
    </h4>
        <br/>
                         <h4>Changes (5)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Configuring Eclipse <br>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3.
Using Ant Eclipse task <br> <br>[QPID-3181|https://issues.apache.org/jira/browse/QPID-3181]
introduced a new Ant target &#39;eclipse&#39; 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. <br> <br>It relies on http://ant-eclipse.sourceforge.net/
which is not included in the Qpid tree and must be downloaded/installed separately. <br>
<br>Proceed as follows: <br> <br>1. Download the Ant-Eclipse task from http://ant-eclipse.sourceforge.net/.
 Version 1.0 or higher is required. <br>2. Unpack the Ant-Eclipse distribution and install
the Ant-Eclipse task (ant-eclipse-*.jar) in Ant&#39;s /lib directory. <br>3. Run
the normal Qpid &#39;build&#39; target to create the Generated Code. <br>{noformat}
<br>cd quid/java <br>ant -f build.xml build <br>{noformat} <br>4.
From the same directory, run the &#39;eclipse&#39; target to create the .project and
.classpath files. <br>{noformat} <br>ant -f build.xml eclipse -Declipse.container=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot;
-Declipse.compilercompliance=6.0  <br>{noformat} <br>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 &lt;classpath
kind=&quot;con&quot;../&gt; element in the file. <br> <br>5. In Eclipse
in a new workspace, import the Qpid projects using the Import -&gt; General -&gt;
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. <br>
<br>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 &quot;Linked Sources&quot; 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&#39; properties. <br> <br>In the broker project create
a linked source to folder location build/scratch/broker/src/ called &quot;scratch_src&quot;
<br>In the client project create a linked source to folder location build/scratch/client/src/
called &quot;scratch_src&quot; <br>In the common project create a linked source
to folder location build/scratch/common/src/ called &quot;scratch_src&quot; <br>In
the broker-plugins-access-control project create a linked source to folder location build/scratch/broker-plugins/access-control/src/
called &quot;scratch_src&quot; <br> <br>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. <br> <br>8. Run a Project -&gt; Clean/Build in
the Eclipse workspace to rebuild Qpid. You should have no build errors.   You are now ready
to develop Qpid with Eclipse. <br> <br>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 <br>the property -Declipse.updatealways=true on the
command line. <br> <br> <br> <br>h3. Manually <br> <br></td></tr>
            <tr><td class="diff-unchanged" >1. Run the ant build from the root
directory of Java trunk. <br>2. New project -&gt; create from existing file system
for broker, common, client, junit-toolkit, perftests, systests and each directory under management
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >6. Setup Dependencies <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">h<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">3</span><span
class="diff-added-chars"style="background-color: #dfd;">4</span>.</span> Generated
Code <br></td></tr>
            <tr><td class="diff-unchanged" >The Broker and Common packages both
depend on generated code. After running &#39;ant&#39; the build/scratch directory
will contain this generated code. <br>For the broker module add build/scratch/broker/src
<br>For the common module add build/scratch/common/src <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">h<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">3</span><span
class="diff-added-chars"style="background-color: #dfd;">4</span>.</span> Dependencies
<br></td></tr>
            <tr><td class="diff-unchanged" >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: <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > - common <br> - junit-toolkit
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
- management/tools/qpid-cli <br></td></tr>
            <tr><td class="diff-unchanged" > <br>*perftests* <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > - management/common <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">*management/console*
<br> - common <br> - client <br> <br>*management/agent* <br>
- common <br> - client <br> <br>*management/tools/qpid-cli* <br> -
common <br> - management/common <br> <br>*management/client* <br>
- common <br> - client <br> <br></td></tr>
            <tr><td class="diff-unchanged" >*integrationtests* <br> - systests
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="QpidJavaBuildHowTo-BuildInstructionsGeneral"></a>Build
Instructions - General</h1>

<h2><a name="QpidJavaBuildHowTo-Checkoutthesource"></a>Check out the source</h2>

<p>Firstly, check the source for Qpid out of our subversion repository:</p>

<p><a href="https://svn.apache.org/repos/asf/qpid/trunk" class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/qpid/trunk</a></p>

<h2><a name="QpidJavaBuildHowTo-Prerequisites"></a>Prerequisites</h2>

<p>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.</p>

<p>Check it's ok by executing java -v !</p>

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

<h1><a name="QpidJavaBuildHowTo-BuildInstructionsTrunk"></a>Build Instructions
- Trunk </h1>

<p>Our build system has reverted to ant as of May 2008.</p>

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

<h2><a name="QpidJavaBuildHowTo-AntBuildScripts"></a>Ant Build Scripts</h2>

<p>Currently the Qpid java project builds using ant.</p>

<p>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.</p>

<p>So, at the top level there are:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>File</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'>build.xml</td>
<td class='confluenceTd'>Top level build file for the project which defines all the
build targets</td>
</tr>
<tr>
<td class='confluenceTd'>common.xml</td>
<td class='confluenceTd'>Common properties used throughout the build system</td>
</tr>
<tr>
<td class='confluenceTd'>module.xml</td>
<td class='confluenceTd'>Template used by all modules which sets up properties for module
builds</td>
</tr>
</tbody></table>
</div>


<p>Then, in each module subdirectory there is:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>File</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'>build.xml</td>
<td class='confluenceTd'>Defines all the module values for template properties</td>
</tr>
</tbody></table>
</div>


<h2><a name="QpidJavaBuildHowTo-Buildtargets"></a>Build targets</h2>

<p>The main build targets you are probably interested in are:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Target</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'>build</td>
<td class='confluenceTd'>Builds all source code for Qpid </td>
</tr>
<tr>
<td class='confluenceTd'>test</td>
<td class='confluenceTd'>Runs the testsuite for Qpid </td>
</tr>
</tbody></table>
</div>


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

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

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

<h2><a name="QpidJavaBuildHowTo-ConfiguringEclipse"></a>Configuring Eclipse</h2>

<h3><a name="QpidJavaBuildHowTo-UsingAntEclipsetask"></a>Using Ant Eclipse
task</h3>

<p><a href="https://issues.apache.org/jira/browse/QPID-3181" class="external-link"
rel="nofollow">QPID-3181</a> 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.</p>

<p>It relies on <a href="http://ant-eclipse.sourceforge.net/" class="external-link"
rel="nofollow">http://ant-eclipse.sourceforge.net/</a> which is not included in the
Qpid tree and must be downloaded/installed separately.</p>

<p>Proceed as follows:</p>

<p>1. Download the Ant-Eclipse task from <a href="http://ant-eclipse.sourceforge.net/"
class="external-link" rel="nofollow">http://ant-eclipse.sourceforge.net/</a>.  Version
1.0 or higher is required.<br/>
2. Unpack the Ant-Eclipse distribution and install the Ant-Eclipse task (ant-eclipse-*.jar)
in Ant's /lib directory.<br/>
3. Run the normal Qpid 'build' target to create the Generated Code.</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>cd quid/java
ant -f build.xml build
</pre>
</div></div>
<p>4. From the same directory, run the 'eclipse' target to create the .project and .classpath
files.</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>ant -f build.xml eclipse -Declipse.container="org.eclipse.jdt.launching.JRE_CONTAINER"
-Declipse.compilercompliance=6.0 
</pre>
</div></div>
<p>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 &lt;classpath kind="con"../&gt; element in the file.</p>

<p>5. In Eclipse in a new workspace, import the Qpid projects using the Import -&gt;
General -&gt; 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.</p>

<p>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.</p>

<p>In the broker project create a linked source to folder location build/scratch/broker/src/
called "scratch_src"<br/>
In the client project create a linked source to folder location build/scratch/client/src/
called "scratch_src"<br/>
In the common project create a linked source to folder location build/scratch/common/src/
called "scratch_src"<br/>
In the broker-plugins-access-control project create a linked source to folder location build/scratch/broker-plugins/access-control/src/
called "scratch_src"</p>

<p>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.</p>

<p>8. Run a Project -&gt; Clean/Build in the Eclipse workspace to rebuild Qpid.
You should have no build errors.   You are now ready to develop Qpid with Eclipse.</p>

<p>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<br/>
the property -Declipse.updatealways=true on the command line.</p>



<h3><a name="QpidJavaBuildHowTo-Manually"></a>Manually</h3>

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

<h4><a name="QpidJavaBuildHowTo-GeneratedCode"></a>Generated Code</h4>
<p>The Broker and Common packages both depend on generated code. After running 'ant'
the build/scratch directory will contain this generated code.<br/>
For the broker module add build/scratch/broker/src<br/>
For the common module add build/scratch/common/src</p>

<h4><a name="QpidJavaBuildHowTo-Dependencies"></a>Dependencies</h4>
<p>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:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>for i in `find . -name build.xml` ; do echo "$i:"; grep module.depends $i ; done
</pre>
</div></div>

<p>The <em>module.depend</em> value will detail which other modules are
dependencies. </p>

<p><b>broker</b></p>
<ul class="alternate" type="square">
	<li>common</li>
	<li>management/common</li>
</ul>


<p><b>client</b></p>
<ul class="alternate" type="square">
	<li>Common</li>
</ul>


<p><b>systest</b></p>
<ul class="alternate" type="square">
	<li>client</li>
	<li>management/common</li>
	<li>broker</li>
	<li>broker/test</li>
	<li>common</li>
	<li>junit-toolkit</li>
</ul>


<p><b>perftests</b></p>
<ul class="alternate" type="square">
	<li>systests</li>
	<li>client</li>
	<li>broker</li>
	<li>common</li>
	<li>junit-toolkit</li>
</ul>


<p><b>management/eclipse-plugin</b></p>
<ul class="alternate" type="square">
	<li>broker</li>
	<li>common</li>
	<li>management/common</li>
</ul>


<p><b>integrationtests</b></p>
<ul class="alternate" type="square">
	<li>systests</li>
	<li>client</li>
	<li>common</li>
	<li>junit-toolkit</li>
</ul>


<p><b>testkit</b></p>
<ul class="alternate" type="square">
	<li>client</li>
	<li>broker</li>
	<li>common</li>
</ul>


<p><b>tools</b></p>
<ul class="alternate" type="square">
	<li>client</li>
	<li>common</li>
</ul>


<p><b>client/examples</b></p>
<ul class="alternate" type="square">
	<li>common</li>
	<li>client</li>
</ul>


<p><b>broker-plugins</b></p>
<ul class="alternate" type="square">
	<li>client</li>
	<li>management/common</li>
	<li>broker</li>
	<li>common</li>
	<li>junit-toolkit</li>
</ul>




<h2><a name="QpidJavaBuildHowTo-Whatnext%3F"></a>What next ?</h2>

<p>If you want to run your built Qpid package, see our <a href="/confluence/display/qpid/Getting+Started+Guide"
title="Getting Started Guide">Getting Started Guide</a> for details of how to do
that.</p>

<p>If you want to run our tests, you can use the ant test or testreport (produces a
useful report) targets.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/qpid/Qpid+Java+Build+How+To">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=29231&revisedVersion=33&originalVersion=32">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/qpid/Qpid+Java+Build+How+To?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message