<!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="http://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 Maven3
</h3>
<span style="margin-bottom: 10px;">
modified by <a href="http://community.jboss.org/people/nickboldt">Nick Boldt</a> in <i>JBoss Tools Development</i> - <a href="http://community.jboss.org/docs/DOC-15513">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Current trunk version of JBoss Tools can be built with maven 3 and make it faster and easier for everyone.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><em><strong>If you're trying to compile JBoss Tools within Eclipse for plugin development, <a class="jive-link-external-small" href="https://community.jboss.org/wiki/JBossToolsTargetPlatformProvisioningorhowtoresolvemissingdependencieswhencompilingJBossTools">read this to get all the dependencies installed</a>.</strong></em></p><h2>Prerequisites</h2><ol><li>Java 1.6 SDK</li><li>Maven 3.beta1</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)</li><li>subversion client 1.6.X  (should work with lower version as well)</li></ol><h2>Environment Setup</h2><h3>Maven  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;"> </p><pre class="jive-pre"><code class="jive-code"> mvn -version</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>should  print out something like</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">Apache Maven 3.0-beta-2 (r983206; 2010-08-07 07:00:51-0400)
Java version: 1.6.0_18
Java home: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32.14-127.fc12.i686" arch: "i386" Family: "unix"
</code></pre><h3>Sources</h3><p>Checkout  sources from anonymous SVN like</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> svn co http://anonsvn.jboss.org/repos/jbosstools/trunk jbosstools-trunk</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>This  will take some time dependent on your bandwidth</p><h2>Build Strategies</h2><p>Instructions below assume that commands are executed in jbosstools-src folder, in which all sources were previously checked out, as noted above.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>There are several strategies to chose from: building everything, building individual component, building a set of components, building individual plugins or features. Depending on where you run Maven, you will aggregate/cascade down into more or less child builds.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="color: #ff0000;">But before you can do anything more complicated, you must first build the Target Platform and Parent Pom using this step:<br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -f build/parent/pom.xml</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3>Build/Test Everything</h3><p>From the root of the checked out projects (eg., jbosstools-src folder), you can build everything in one step, including running all tests, like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Or, if you want to just compile the modules (plugins, features, tests, update sites) without <strong>running</strong> tests, add the system property <strong>-Dmaven.test.skip=true</strong>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -Dmaven.test.skip=true
</code></pre><h3></h3><h3>Build/Test  A Particular Component and its Dependencies</h3><p>For convenience there are bootstrap profiles projects defined for each component. This provides a simple way to build & test components along with all their dependencies.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -f build/pom.xml -P${component.name}-bootstrap</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>where  ${component.name} is component you want to build/test. Check in build/pom.xml for the available components you can build this way.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Once bootstrapped, you can then rebuild just the component you care about using this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -f build/pom.xml -P${component.name}</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>If you prefer to do things iteratively (one component at a time) you can check the order to build in <a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/jbosstools/trunk/pom.xml">http://anonsvn.jboss.org/repos/jbosstools/trunk/pom.xml</a> or <a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/jbosstools/trunk/build/pom.xml">http://anonsvn.jboss.org/repos/jbosstools/trunk/build/pom.xml</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3>Build/Test Single Component or Module</h3><p>If you have already bootstrapped a build by compiling all its dependencies (as in the previous section), you can now (re)build a whole component, or individual plugins/tests/features, using this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -f build/pom.xml -P${component.name}</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>where ${component.name} is component's root folder name. For instance to build jmx component:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -f build/pom.xml -Pjmx</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Or to build but skip <strong>running </strong>tests:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> mvn clean install -f build/pom.xml -Pjmx -Dmaven.test.skip=true</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>You can also build individual plugins or collections of plugins by simply running maven in that artifact's folder:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> cd ~/jbosstools-src/common/plugins; mvn clean install
cd ~/jbosstools-src/common/tests/org.jboss.tools.common.model.ui.test; mvn clean install</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><hr/><h3>Running and Debugging Tests</h3><p>To debug tests, you can read the console output produced by Maven, or you can <a class="jive-link-external-small" href="https://www.jboss.org//tools/docs/testing#remote">enable remote debugging using Eclipse</a>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>To control how Maven will behave and how much console output will be produced, here are some useful flags:</p><pre class="jive-pre"><code class="jive-code"> -fae :: fail at end
-fn  :: fail never
-q   :: quieter output
-e   :: if error occurs, dump stack into console
-X   :: debug output (should log to a file using
`mvn clean install -X | tee log.txt`
because output will be huge)</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><hr/><h3>Adding a Plugin To An Existing Component</h3><p>Now that you can build your component, you can easily add a new plugin to that component. Here's how.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>0. Make sure your new plugin compiles in your workspace. Ensure your MANIFEST.MF contains all references/includes/requirements you need. Be sure to set the correct Bundle-RequireExecutionEnvironment (eg., JDK5 or JDK6).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1. When you are satisfied, you can commit your new plugin project to SVN.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> cd ~/trunk/as/plugins; \
svn add org.jboss.ide.eclipse.as.rse.core; \
svn ci -m "JBIDE-123456 Initial commit of new as.rse.core plugin" org.jboss.ide.eclipse.as.rse.core
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>2. Next, add a pom.xml file to the root of your new project.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>You can use m2eclipse to help w/ this if you have it installed; otherwise copy from another existing plugin project and edit appropriately. The version of the pom should match the version in the manifest.mf. Note that 3.2.0.qualifier (in MANIFEST.MF) is equivalent to 3.2.0-SNAPSHOT in the pom.xml.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>3. Build your plugin:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> cd ~/trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core; \
mvn3 clean install
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>4. If your component's new plugin builds successfully, you can commit the pom.xml file, and add a reference to the new plugin (module) in the container pom:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> vi ~/trunk/as/plugins/pom.xml</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>5. To ensure that your plugin is available on the update site, be sure that it is contained in at least one feature's feature.xml.</p><pre ___default_attr="plain" jivemacro="code"> <p>vi ~/trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml</p></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>6. Finally, ensure that the feature appears in all three update sites:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"> vi ~/trunk/as/site/site.xml # (the AS update site)
vi ~/trunk/site/site.xml # (the JBoss Tools update site) and
vi ~/trunk/build/aggregate/site/site.xml # (the JBoss Tools aggregate update site, incl. pi4soa, Teiid, ...)
</code></pre></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Comment by <a href="http://community.jboss.org/docs/DOC-15513">going to Community</a></p>
        <p style="margin: 0;">Create a new document in JBoss Tools Development at <a href="http://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>