JBoss Community

How to Build JBoss Tools with Maven 3

modified by Nick Boldt in JBoss Tools Development - View the full document

This article is a replacement for its precursor, How to Build JBoss Tools 3.2 with Maven 3.

 

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 How to Build JBoss Tools With Maven3 - Working With Branches.

 

Prerequisites

  1. Java 1.6 SDK
  2. Maven 3.0.3
  3. Ant 1.8.2 or later **NEW**
  4. About 6 GB of free disk space if you want to run all integration tests for (JBoss AS, Seam and Web Services Tools) - requires VPN access
  5. subversion client 1.6.X  (should work with lower version as well, but newer versions may not work as expected)

Environment Setup

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

 

pache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)

Java version: 1.6.0_25, vendor: Sun Microsystems Inc.

Java home: /usr/java/jdk1.6.0_25/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "2.6.42.3-2.fc15.x86_64", arch: "amd64", family: "unix"

#

Building Everything In One Build Locally Via Commandline

 

To run a local build of JBoss Tools 3.3 against the new Eclipse 3.7.2-based Target Platform, I suggest a three two-step approach:

 

a) build the parent & target platform poms (v0.0.2-SNAPSHOT) [NO LONGER REQUIRED, THESE CAN BE RESOLVED FROM JBoss Nexus]

b) resolve the target platform to your local disk [ONLY NEEDED WHEN THIS CHANGES]

c) build against your local copy of the target platform [every time you change sources and want to rebuild]

 

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.

 

(a) and (b) need only be done when the parent pom and Target Platform (TP) change.

 

a) build the parent & 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 JBoss Nexus)

 

 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]
...

 

NOTE: You need not fetch the entire JBoss Tools tree from SVN (or Git).

Instead, you can just fetch the build/ folder and one or more component folders, then as before,

build the parent pom. After that, go into the component folder and run maven there.

 

 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]
...

 

b) resolve the target platform to your local disk

 

There are two ways to do this:

 

i) Download and unpack the latest TP zip, OR

ii) Resolve the TP using Maven or Ant

 

 

i) Download and unpack the latest TP zip

 

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.

 

You can do that with any browser or on a command line with curl or similar:

 

curl -C - -O http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo.SR2/<actualFilename>.target.zip
...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  606M  100  606M    0     0   164k      0  1:02:54  1:02:54 --:--:--  172k

 

and then unzip it here (the default path for -Dlocal.site, which means you can call maven with -Plocal.site and not need to pass in -Dlocal.site=file:///path/to/some/other/folder/ as well):

 

mkdir -p ~/.m2/jbosstools-target-platform_3.3.indigo.SR2/

unzip *.target.zip -d ~/.m2/jbosstools-target-platform_3.3.indigo.SR2/

 

(Note that the default path used for <local.site> 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!)

 

OR


ii) Resolve the TP using Maven 3 or Ant 1.8

 

 cd jbosstools/build/target-platform
 mvn clean install -Pget.local.target

 

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.

 

Since the Maven profile is simply a wrapper call to Ant, you can also use Ant 1.8 or later directly:

 

 cd jbosstools/build/target-platform
 ant help # show usage instructions

 

c) build against your local copy of the target platform

 

NOTE: You must specify a path starting with file:/// (three or more slashes) to avoid errors such as "p2.core.ProvisionException URI has an authority component".

 

LINUX / MAC USERS

 

cd build

mvn clean install -U -B -fae -e -P local.site -Dlocal.site=file:///${HOME}/trunk/build/target-platform/REPO/ | tee build.all.log.txt

 

(tee is a program that pipes console output to BOTH console and a file so you can watch the build AND keep a log.)

 

WINDOWS USERS

 

cd c:\trunk\build

mvn3 clean install -U -B -fae -e -P local.site -Dlocal.site=file:///C:/trunk/build/target-platform/REPO/

   or

mvn3 clean install -U -B -fae -e -Plocal.site -Dlocal.site=file:///C:/trunk/build/target-platform/REPO/ > build.all.log.txt

 

If you downloaded the zip and unpacked is somewhere else, use -Dlocal.site=file:///.../ to point at that folder instead.

#

Building Individual Components Locally Via Commandline

First, see previous section on building everything for parent pom and target platform bootstrapping.

 

Next, to build a single component (or even just a single plugin), go into that folder and run Maven there:

 

cd ~/trunk/jmx

mvn3 clean install -U -B -fae -e -P local.site -Dlocal.site=file:///${HOME}/trunk/build/target-platform/REPO/ | tee build.jmx.log.txt

 

-- OR, if you prefer to use the "bootstrap profiles", which will build a given component PLUS its upstream JBoss Tools dependencies from source: --

 

cd ~/trunk/build

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

 

 

#

Building Locally In Eclipse

 

First, you must have installed m2eclipse into your Eclipse (or JBDS). You can install the currently supported version from this update site:

 

http://download.jboss.org/jbosstools/updates/indigo/

 

Next, start up Eclipse or JBDS and do File > Import to import the project(s) you already checked out from SVN above into your workspace.

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13876/310-276/Screenshot.png

 

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.

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13877/450-259/Screenshot-1.png

Once the project(s) are imported, you'll want to build them. You can either do CTRL-SHIFT-X,M (Run Maven Build), or right-click the project and select Run As > Maven Build. The following screenshots show how to configure a build job.

 

First, on the Main tab, set a Name, Goals, Profile(s), and add a Parameter. Or, if you prefer, put everything in the Goals field for simplicity:

 

clean install -U -B -fae -e -Plocal.site -Dlocal.site=file://home/nboldt/tmp/JBT_REPO_Indigo/

 

Be sure to check Resolve Workspace artifacts, and, if you have a newer version of Maven installed, point your build at that Maven Runtime instead of the bundled one that ships with m2eclipse.

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13878/450-540/Screenshot-2.png

On the JRE tab, make sure you're using a 6.0 JDK.

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13879/450-538/Screenshot-3.png

On the Refresh tab, define which workspace resources you want to refresh when the build's done.

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13880/450-539/Screenshot-4.png

 

On the Common 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.

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13881/450-542/Screenshot-5.png

Click Run to run the build.

 

https://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-28-13882/450-347/Screenshot-6.png

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.

 

´╗┐Tips and tricks for making BOTH PDE UI and headless Maven builds happy

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.


Check your build.properties

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.

 

Especially check your build.properties to have entries for source.. and output..


source.. = src/ 
output.. = bin/ 

 

 

Comment by going to Community

Create a new document in JBoss Tools Development at Community