Max Andersen [
http://community.jboss.org/people/max.andersen%40jboss.com] modified the
document:
"How to Build JBoss Tools with Maven3"
To view the document, visit:
http://community.jboss.org/docs/DOC-15513
--------------------------------------------------------------
Current trunk version of JBoss Tools can be built with maven 3 and make it faster and
easier for everyone.
+*If you're trying to compile JBoss Tools within Eclipse for plugin development,
https://community.jboss.org/wiki/JBossToolsTargetPlatformProvisioningorho...
read this to get all the dependencies installed.*+
h2. Prerequisites
1. Java 1.6 SDK
2. Maven 3.beta1
3. About 6 GB of free disk space if you want to run all integration tests for (JBoss AS,
Seam and Web Services Tools)
4. subversion client 1.6.X (should work with lower version as well)
h2. Environment Setup
h3. Maven and Java
Make sure your maven 3 is available by default and Java 1.6 is used.
mvn -version
should print out something like
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"
h3. Sources
Checkout sources from anonymous SVN like
svn co
http://anonsvn.jboss.org/repos/jbosstools/trunk jbosstools-trunk
This will take some time dependent on your bandwidth
h2. Build Strategies
Instructions below assume that commands are executed in jbosstools-src folder, in which
all sources were previously checked out, as noted above.
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.
But before you can do anything more complicated, you must first build the Target Platform
and Parent Pom using this step:
mvn clean install -f build/parent/pom.xml
h3. Build/Test Everything
First, build the Target Platform and Parent Pom as noted above. Then, 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:
mvn clean install -f build/parent/pom.xml
Or, if you want to just compile the modules (plugins, features, tests, update sites)
without *running* tests, add the system property *-Dmaven.test.skip=true*.
mvn clean install -Dmaven.test.skip=true -f build/parent/pom.xml
h3.
h3. Build/Test A Particular Component and its Dependencies
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.
mvn clean install -f build/pom.xml -P${component.name}-bootstrap
where ${component.name} is component you want to build/test. Check in build/pom.xml for
the available components you can build this way.
Once bootstrapped, you can then rebuild just the component you care about using this:
mvn clean install -f build/pom.xml -P${component.name}
If you prefer to do things iteratively (one component at a time) you can check the order
to build in
http://anonsvn.jboss.org/repos/jbosstools/trunk/pom.xml
http://anonsvn.jboss.org/repos/jbosstools/trunk/pom.xml or
http://anonsvn.jboss.org/repos/jbosstools/trunk/build/pom.xml
http://anonsvn.jboss.org/repos/jbosstools/trunk/build/pom.xml
h3. Build/Test Single Component or Module
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:
mvn clean install -f build/pom.xml -P${component.name}
where ${component.name} is component's root folder name. For instance to build jmx
component:
mvn clean install -f build/pom.xml -Pjmx
Or to build but skip *running* tests:
mvn clean install -f build/pom.xml -Pjmx -Dmaven.test.skip=true
You can also build individual plugins or collections of plugins by simply running maven in
that artifact's folder:
cd ~/jbosstools-src/common/plugins; mvn clean install
cd ~/jbosstools-src/common/tests/org.jboss.tools.common.model.ui.test; mvn clean install
Putting it all together, here's how you could build & test the JMX Core plugin:
mvn clean install -f build/parent/pom.xml # parent pom
mvn clean install -f build/pom.xml -Pjmx-bootstrap -Dmaven.test.skip # bootstrap deps
mvn clean install -f jmx/plugins/org.jboss.tools.jmx.core/pom.xml # rebuild plugin
mvn clean install -f jmx/tests/org.jboss.tools.jmx.core.test/pom.xml # rebuild & run
test
----
h3. Running and Debugging Tests
To debug tests, you can read the console output produced by Maven, or you can
https://www.jboss.org//tools/docs/testing#remote enable remote debugging using Eclipse.
To control how Maven will behave and how much console output will be produced, here are
some useful flags:
-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)
----
h3. Adding a Plugin To An Existing Component
Now that you can build your component, you can easily add a new plugin to that component.
Here's how.
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).
1. When you are satisfied, you can commit your new plugin project to SVN.
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
2. Next, add a pom.xml file to the root of your new project.
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.
3. Build your plugin:
cd ~/trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core; \
mvn3 clean install
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:
vi ~/trunk/as/plugins/pom.xml
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.
vi ~/trunk/as/features/org.jboss.ide.eclipse.as.feature/feature.xml
6. Finally, ensure that the feature appears in all three update sites:
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, ...)
--------------------------------------------------------------
Comment by going to Community
[
http://community.jboss.org/docs/DOC-15513]
Create a new document in JBoss Tools Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=102&am...]