<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    How to Build JBoss Tools with Maven 3
</h3>
<span style="margin-bottom: 10px;">
    modified by <a href="https://community.jboss.org/people/nickboldt">Nick Boldt</a> in <i>JBoss Tools Development</i> - <a href="https://community.jboss.org/docs/DOC-16604">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p><em><strong>This article is a replacement for its precursor, <a class="jive-link-wiki-small" href="https://community.jboss.org/docs/DOC-15513">How to Build JBoss Tools 3.2 with Maven 3</a>. </strong></em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em><strong>Note that this article only discusses building from trunk. If you need to build from a branch, or switch between branches and/or trunk, see </strong><a class="jive-link-wiki-small" href="https://community.jboss.org/docs/DOC-17497"><strong>How to Build JBoss Tools With Maven3 - Working With Branches</strong></a></em>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h2>Prerequisites</h2><ol><li>Java 1.6 SDK</li><li>Maven 3.0.3</li><li>Ant 1.8.2 or later <span style="color: #ff6600;"><strong>**NEW**</strong></span></li><li>About 6 GB of free disk space if you want to run all integration tests for (JBoss AS, Seam and Web Services Tools) - <span style="color: #ff0000;"><strong>requires VPN access</strong></span></li><li>subversion client 1.6.X&#160; (should work with lower version as well, but newer versions may not work as expected)</li></ol><h2>Environment Setup</h2><h3>Maven&#160; and Java</h3><p>Make sure your maven 3 is available by default and Java 1.6 is used.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive_text_macro jive_macro_code"> mvn -version</pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>should&#160; print out something like</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive_text_macro jive_macro_code"><p><strong>pache Maven 3.0.3</strong> (r1075438; 2011-02-28 12:31:09-0500)</p><p><strong>Java version: 1.6.0_25</strong>, vendor: Sun Microsystems Inc.</p><p><strong>Java home: /usr/java/jdk1.6.0_25/jre</strong></p><p>Default locale: en_US, platform encoding: UTF-8</p><p>OS name: "linux", version: "2.6.42.3-2.fc15.x86_64", arch: "amd64", family: "unix"</p></pre><p><a class="jive-link-anchor-small" name="build-everything">#</a></p><h2>Building Everything In One Build Locally Via Commandline</h2><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>To run a local build of JBoss Tools 3.3 against the new <strong>Eclipse 3.7.2</strong>-based Target Platform, I suggest a <span style="text-decoration: line-through;">three</span> two-step approach:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: line-through;">a) build the parent &amp; target platform poms (v0.0.2-SNAPSHOT)</span> <strong>[NO LONGER REQUIRED, THESE CAN BE RESOLVED FROM <a class="jive-link-external-small" href="https://repository.jboss.org/nexus/content/repositories/snapshots/org/jboss/tools/">JBoss Nexus</a>]</strong></p><p>b) resolve the target platform to your local disk <strong>[ONLY NEEDED <a class="jive-link-external-small" href="https://source.jboss.org/browse/JBossTools/trunk/build/target-platform/unified.target">WHEN THIS CHANGES</a>]</strong></p><p>c) build against your local copy of the target platform [every time you change sources and want to rebuild]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Once (a) and (b) are done, you need only perform (c) iteratively until you're happy (that is, until everything compiles). This lets you test changes locally before committing back to SVN.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #ff0000;"><strong>(a) and (b) need only be done when the parent pom and Target Platform (TP) change.</strong></span> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>a) build the parent &amp; target platform poms (v0.0.3-SNAPSHOT is used for Beta1 and Beta2; v0.0.4-SNAPSHOT is used for Beta3 and beyond, and can be found in <a class="jive-link-external-small" href="https://repository.jboss.org/nexus/content/repositories/snapshots/org/jboss/tools/">JBoss Nexus</a>)<br/></strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code"> svn co http://svn.jboss.org/repos/jbosstools/trunk jbosstools
 cd jbosstools/build/parent
 mvn clean install
...
[INFO] Reactor Summary:
[INFO] 
[INFO] JBoss Tools Target Platform Definition ............ SUCCESS [0.724s]
[INFO] JBoss Tools Parent ................................ SUCCESS [0.461s]
...
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #ff6600;"><strong>NOTE: You need not fetch the entire JBoss Tools tree from SVN (or <a class="jive-link-external-small" href="http://divby0.blogspot.com/2011/01/howto-partially-clone-svn-repo-to-git.html">Git</a>). </strong></span></p><p><span style="color: #ff6600;"><strong>Instead, you can just fetch the build/ folder and one or more component folders, then as before, </strong></span></p><p><span style="color: #ff6600;"><strong>build the parent pom. After that, <a class="jive-link-anchor-small" href="#runmavenpercomponent">go into the component folder and run maven there</a>.</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code"> mkdir jbosstools
 cd jbosstools
 svn co http://svn.jboss.org/repos/jbosstools/trunk/build
 svn co http://svn.jboss.org/repos/jbosstools/trunk/jmx
 cd jbosstools/build/parent
 mvn clean install
...
[INFO] Reactor Summary:
[INFO] 
[INFO] JBoss Tools Target Platform Definition ............ SUCCESS [0.724s]
[INFO] JBoss Tools Parent ................................ SUCCESS [0.461s]
...
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>b) resolve the target platform to your local disk</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>There are two ways to do this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i) Download and unpack the latest TP zip, <span style="color: #ff0000;"><strong>OR</strong></span></p><p>ii) Resolve the TP using Maven or Ant</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em>i) Download and unpack the latest TP zip</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>You can either download the TP as a zip [5] and unpack it into some folder on your disk. For convenience, the easiest is to unzip into jbosstools/build/target-platform/REPO/, since that's where the Maven or Ant process will by default operate.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>You can do that with any browser or on a command line with curl or similar:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">curl -C - -O http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo.SR2/&lt;actualFilename&gt;.target.zip
...
&#160; % Total&#160;&#160;&#160; % Received % Xferd&#160; Average Speed&#160;&#160; Time&#160;&#160;&#160; Time&#160;&#160;&#160;&#160; Time&#160; Current
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dload&#160; Upload&#160;&#160; Total&#160;&#160; Spent&#160;&#160;&#160; Left&#160; Speed
100&#160; 606M&#160; 100&#160; 606M&#160;&#160;&#160; 0&#160;&#160;&#160;&#160; 0&#160;&#160; 164k&#160;&#160;&#160;&#160;&#160; 0&#160; 1:02:54&#160; 1:02:54 --:--:--&#160; 172k
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>and then unzip it here (the default path for -Dlocal.site, which means you can call maven with <em><strong>-Plocal.site</strong></em> and not need to pass in <em><strong>-Dlocal.site=file:///path/to/some/other/folder/</strong></em> as well):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre ___default_attr="plain" class="jive_text_macro jive_macro_code"><p>mkdir -p ~/.m2/jbosstools-target-platform_3.3.indigo.SR2/</p><p>unzip *.target.zip -d ~/.m2/jbosstools-target-platform_3.3.indigo.SR2/ </p></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong style="color: #3366ff;">(Note that the default path used for &lt;local.site&gt; will change every time a new target platform is released which is a significant change over the previous (eg., SR1, SR2), so if this breaks because the default not points at an empty folder, it's time to get a new TP! Hurray for build-time notification you're using an old target platform!)</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #ff0000; font-size: 12pt;"><strong>OR</strong></span></p><p><span style="color: #ff0000;"><strong><br/></strong></span></p><p><em>ii) Resolve the TP using Maven 3 or Ant 1.8</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code"> cd jbosstools/build/target-platform
 mvn clean install -Pget.local.target
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The get.local.target profile will resolve the target platform file, multiple.target, as a p2 repository on your local disk in ~/trunk/build/target-platform/REPO/. It may take a while, so you're better off from a speed point-of-view simply fetching the latest zip [5]. However, if you want to see what actually happens to create the TP (as done in Hudson) this is the approach to take.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Since the Maven profile is simply a wrapper call to Ant, you can also use Ant 1.8 or later directly:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code"> cd jbosstools/build/target-platform
 ant help # show usage instructions
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>c) build against your local copy of the target platform</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #ff6600;"><strong>NOTE: </strong></span>You must specify a path starting with <strong>file:///</strong> (<span style="text-decoration: underline;">three or more slashes</span>) to avoid errors such as "<em>p2.core.ProvisionException URI has an authority component</em>".</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> <span style="color: #ff0000;"><strong>LINUX / MAC USERS</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>cd build</p><p> mvn clean install -U -B -fae -e -P local.site -Dlocal.site=file:///${HOME}/trunk/build/target-platform/REPO/ | tee build.all.log.txt</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>(tee is a program that pipes console output to BOTH console and a file so you can watch the build AND keep a log.)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #ff0000;"><strong>WINDOWS USERS</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>cd c:\trunk\build</p><p>mvn3 clean install -U -B -fae -e -P local.site -Dlocal.site=file:///C:/trunk/build/target-platform/REPO/</p><p>&#160;&#160; or</p><p>mvn3 clean install -U -B -fae -e -Plocal.site -Dlocal.site=file:///C:/trunk/build/target-platform/REPO/ &gt; build.all.log.txt</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If you downloaded the zip and unpacked is somewhere else, use -Dlocal.site=file:///.../ to point at that folder instead.</p><p><a class="jive-link-anchor-small" name="runmavenpercomponent">#</a></p><h2>Building Individual Components Locally Via Commandline</h2><p>First, see <a class="jive-link-external-small" href="#build-everything">previous section on building everything</a> for parent pom and target platform bootstrapping. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Next, to build a single component (or even just a single plugin), go into that folder and run Maven there:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> cd ~/trunk/jmx</p><p> mvn3 clean install -U -B -fae -e -P local.site -Dlocal.site=file:///${HOME}/trunk/build/target-platform/REPO/ | tee build.jmx.log.txt</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em> -- OR, if you prefer to use the "bootstrap profiles", which will build a given component PLUS its upstream JBoss Tools dependencies from source: --</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>cd ~/trunk/build</p><p>mvn3 clean install -U -B -fae -e -P local.site,jmx-bootstrap -Dlocal.site=file:///${HOME}/trunk/build/target-platform/REPO/ | tee build.jmx.log.txt</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><em> </em>&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a class="jive-link-anchor-small" name="buildInEclipse">#</a></p><h2>Building Locally In Eclipse</h2><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>First, you must have installed m2eclipse into your Eclipse (or JBDS). You can install the currently supported version from this update site:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a class="jive-link-external-small" href="http://download.jboss.org/jbosstools/updates/indigo/">http://download.jboss.org/jbosstools/updates/indigo/</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Next, start up Eclipse or JBDS and do <strong>File &gt; Import</strong> to import the project(s) you already checked out from SVN above into your workspace.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13876/Screenshot.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13876/310-276/Screenshot.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Browse to where you have the project(s) checked out, and select a folder to import pom projects. In this case, I'm importing the parent pom (which refers to the target platform pom). Optionally, you can add these new projects to a working set to collect them in your Package Explorer view.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13877/Screenshot-1.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13877/450-259/Screenshot-1.png </span></a></p><p>Once the project(s) are imported, you'll want to build them. You can either do <strong>CTRL-SHIFT-X,M (Run Maven Build),</strong> or right-click the project and select <strong>Run As &gt; Maven Build</strong>. The following screenshots show how to configure a build job.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>First, on the <strong>Main</strong> tab, set a <strong>Name</strong>, <strong>Goals</strong>, <strong>Profile</strong>(s), and add a <strong>Parameter</strong>. Or, if you prefer, put everything in the <strong>Goals</strong> field for simplicity:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em>clean install -U -B -fae -e -Plocal.site -Dlocal.site=file://home/nboldt/tmp/JBT_REPO_Indigo/</em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Be sure to check <strong>Resolve Workspace artifacts</strong>, and, if you have a newer version of Maven installed, point your build at that <strong>Maven Runtime</strong> instead of the bundled one that ships with m2eclipse.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13878/Screenshot-2.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13878/450-540/Screenshot-2.png </span></a></p><p>On the <strong>JRE</strong> tab, make sure you're using a 6.0 JDK.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13879/Screenshot-3.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13879/450-538/Screenshot-3.png </span></a></p><p>On the <strong>Refresh</strong> tab, define which workspace resources you want to refresh when the build's done.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13880/Screenshot-4.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13880/450-539/Screenshot-4.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>On the <strong>Common</strong> tab, you can store the output of the build in a log file in case it's particularly long and you need to refer back to it.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13881/Screenshot-5.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13881/450-542/Screenshot-5.png </span></a></p><p>Click <strong>Run</strong> to run the build.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/102-16604-28-13882/Screenshot-6.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13882/450-347/Screenshot-6.png </span></a></p><p>Now you can repeat the above step to build any other component or plugin or feature or update site from the JBoss Tools repo. Simply import the project(s) and build them as above.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h2>Tips and tricks for making BOTH PDE UI and headless Maven builds happy</h2><p>It's fairly common to have plugins compiling in eclipse while tycho would not work. Basically you could say that tycho is far more picky compared to Eclipse PDE. </p><h3><br/>Check your build.properties</h3><p>Check build.properties in your plugin. If it has warnings in Eclipse, you'll most likely end with tycho failing to compile your sources. You'll have to make sure that you correct all warnings. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Especially check your build.properties to have entries for <strong>source..</strong> and <strong>output..</strong></p><p><strong><br/></strong></p><pre class="jive-pre"><code class="jive-code jive-java">source.. = src/&#160;
output.. = bin/&#160;
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h2><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></h2></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="https://community.jboss.org/docs/DOC-16604">going to Community</a></p>

        <p style="margin: 0;">Create a new document in JBoss Tools Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2129">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>