[jboss-dev-forums] [JBoss Tools Development] - How to Build JBoss Tools with Maven 3
Andre Dietisheim
do-not-reply at jboss.com
Wed Mar 30 10:59:38 EDT 2011
Andre Dietisheim [http://community.jboss.org/people/adietish] modified the document:
"How to Build JBoss Tools with Maven 3"
To view the document, visit: http://community.jboss.org/docs/DOC-16604
--------------------------------------------------------------
+*This article is a replacement for its precursor, http://community.jboss.org/docs/DOC-15513 How to Build JBoss Tools 3.2 with Maven 3.*+
h2. Prerequisites
1. Java 1.6 SDK
2. Maven 3
3. Ant 1.7.1 or later
4. About 6 GB of free disk space if you want to run all integration tests for (JBoss AS, Seam and Web Services Tools)
5. 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.2* (r1056850; 2011-01-08 19:58:10-0500)
*Java version: 1.6.0_20*, vendor: Sun Microsystems Inc.
*Java home: /usr/java/jdk1.6.0_20/jre*
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32.23-170.fc12.i686", arch: "i386", family: "unix"
h2.
h2. Building Locally Via Commandline
To run a local build of JBoss Tools 3.3 against the new Eclipse 3.7-based Target Platform, I suggest a three-step approach:
a) build the parent & target platform poms (v0.0.3-SNAPSHOT) *[ONLY NEEDED WHEN THESE CHANGE]*
b) resolve the target platform to your local disk *[ONLY NEEDED WHEN THESE CHANGE]*
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.* Of course if we get these published to nexus then you may not need those first bootstrapping steps. Stay tuned - work in progress.
*a) build the parent & target platform poms (v0.0.3-SNAPSHOT)*
cd ~/
svn co http://svn.jboss.org/repos/jbosstools/branches/3.3.indigo/ http://svn.jboss.org/repos/jbosstools/branches/3.3.indigo/
cd ~/3.3.indigo/build/parent
mvn3 clean install
*b) resolve the target platform to your local disk*
There are two ways to do this:
i) Download and unpack the latest TP zip
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, you might want to unzip into ~/3.3.indigo/build/target-platform/REPO/, since that's where the Maven or Ant process will by default operate.
[5] http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/e37M5-wtp33M5.target.zip http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/e37M5-wtp33M5.target.zip
+ii) Resolve the TP using Maven or Ant+
cd ~/3.3.indigo/build/target-platform
mvn3 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 ~/3.3.indigo/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.7.1 or later directly:
cd ~/3.3.indigo/build/target-platform
ant
Should you want to build the JBDS target, do this:
cd ~/3.3.indigo/build/target-platform
ant jbds
Then you'll get a p2 repo in ~/3.3.indigo/build/target-platform/JBDS_REPO/.
*c) build against your local copy of the target platform*
*LINUX / MAC USERS*
cd ~/3.3.indigo/build
mvn3 clean install -U -B -fae -e -P local.site -Dlocal.site=file:/${HOME}/3.3.indigo/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:\3.3.indigo\build
mvn3 clean install -U -B -fae -e -P local.site-Dlocal.site=file:///C:/3.3.indigo/build/target-platform/REPO/
or
mvn3 clean install -U -B -fae -e -Plocal.site-Dlocal.site=file:///C:/3.3.indigo/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.
If you would rather build a single component (or even just a single plugin), go into that folder and run Maven there:
cd ~/3.3.indigo/build/jmx
mvn3 clean install -U -B -fae -e -P local.site -Dlocal.site=file:/${HOME}/3.3.indigo/build/target-platform/REPO/ | tee build.jmx.log.txt
#
h2. 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/ 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.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13876/Screenshot.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-13876/450-400/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.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13877/Screenshot-1.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-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.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13878/Screenshot-2.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-13878/450-540/Screenshot-2.png
On the *JRE* tab, make sure you're using a 6.0 JDK.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13879/Screenshot-3.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-13879/450-538/Screenshot-3.png
On the *Refresh* tab, define which workspace resources you want to refresh when the build's done.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13880/Screenshot-4.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-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.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13881/Screenshot-5.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-13881/450-542/Screenshot-5.png
Click *Run* to run the build.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16604-9-13882/Screenshot-6.png http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16604-9-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.
h2. Tips an tricks for making BOTH PDE and Maven 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.
h3.
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.
Especially check your build.properties to have entries for *source..* and *output..*
*
*
source.. = src/
output.. = bin/
h2.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-16604]
Create a new document in JBoss Tools Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2129]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110330/5b48fa1a/attachment.html
More information about the jboss-dev-forums
mailing list