Eclipse RCP
20.09.2010 - 24.09.2010, Hamburg
git
07.10.2010 - 08.10.2010, Essen
19.01.2010

Headless Eclipse RCP builds with Buckminster and Hudson

After visiting the “From source to automated builds with Buckminster and p2” presentation at Eclipse Summit Europe 2009 I had to give building RCP applications with Buckminster a try. And I wasn’t disappointed - despite from some minor file permission issues which took some time to debug, everything worked like a charm.

So I decided to extend my training materials for my Eclipse RCP training course (the next one is in March in Frankfurt/Main) to use Buckminster instead of PDE Build. I wrote the following tutorial as preparation for the course.

The tutorial will show you how to set up a headless build for the Mail sample application using Eclipse Buckminster and the Hudson build server. I assume you’re familiar with OSGi and Eclipse RCP development. You will learn:

Preparation

Defining and sharing the target platform

Eclipse RCP applications are developed with a target platform containing all the platform features and bundles which are required for the application. This is configured in Window > Preferences > Plug-in Development > Target Platform. Create a new, empty target definition. Add Eclipse RCP SDK and Eclipse Platform Launchers from the Eclipse Software Site (you have to uncheck Group by category to see the feature). Uncheck Include Required Software so that you can check Include all environments (otherwise the target is only suitable for building on your own platform):

Add Eclipse RCP feature

The target definition should look like this:

Eclipse RCP Target Definition

Click Move to move the target definition to a file rcp.target in the feature com.example.mail.site. This persists the target platform as file. That way, the target definition can be shared with other developers and can be used by the build.

Exporting a p2 site for the application using Buckminster

The first step is to use Buckminster from the IDE to build the contents of the feature com.example.mail.site and to create a software site for the results.

Installing the product from the p2 repository manually

The exported p2 site contains all the features and bundles of the product for all platforms. You could install the mail product from this software site now. The task of going to a p2 repository and installing an application locally is performed by the p2 director. If you have not used the director before, you should try to do this manually now to learn how it works. Otherwise you can skip to the next section.

How to automate installing the product

Usually users don’t want to install products by calling the director. Instead, a full installation is zipped together and distributed. You can automate this using Buckminster as well, but it is not supported out of the box. You need to add a custom buckminster task utilizing ant.

Automating the build using Hudson

One very helpful aspect about building with Buckminster is that you can automate builds using the Hudson build system. Before we can do that, we need to define how Buckminster should obtain our projects.

Example code

I created a github project for the mail example: com.example.mail.buckminster

There is also example code in the Buckminster SVN (see org.eclipse.buckminster.tutorial.mailapp.releng).

Possible improvements

This tutorial leaves some room for improvement for the reader. I plan to extend this tutorial, but for the moment you’ll have to do some work on your own. If you find solutions for one of the following problems, please post a comment about it!

More information

Thanks

Thanks to Henrik and Thomas for showing and explaining Buckminster at their ESE talk “From source to automated builds with Buckminster and p2”. Also big thanks to all the people providing all these pieces of useful information about Hudson and Buckminster in the Eclipse newsgroups and wiki which I took as starting point for this tutorial - especially to Johannes Utzig for the existing RCP+Buckminster tutorial.

Updates

Martin Dilger, 05. November, 21:01 Uhr

hi once again,
really nice tutorial..
I read about Buckminster before, but I never tried it myself.

Thanks for this.

Karsten Thoms, 06. November, 07:06 Uhr

Hi Ralf!

Really good article! I was also in the ESE talk and decided to finally use Buckminster and started to work through the docs. Was not as easy as expected, but your article really helped to get things done!

~Karsten

Christian, 06. November, 13:42 Uhr

great tutorial, thank you very much!

Cheney, 12. November, 07:14 Uhr

Cool! Thanks!
But I have some problem that building the com.example.mail.buckminster project source with hudson.

First, in Automating the target platform build using Hudson step 8: #

Add a build step "Run Buckminster". Configure it to import the target.mspec using:

import ${WORKSPACE}/com.example.mail.target/target.mspec

the correct one should be: import ${WORKSPACE}/com.example.target/target.mspec, and then the rcp_target platform build successful.

Second, I get step by step from the Automating the product build using Hudson instruction, but it always builds failure, below is the console output from hudson:

[...]
/data/ssis/.hudson/jobs/MailAppExample/workspace/arch/x86_64/os/macosx/ws/cocoa/com.example.mail.feature/build/product.ant:22: Java returned: 13
[...]

Can you please give me some suggestion how to fix the build product problem?

Ralf Ebert, 17. November, 10:23 Uhr

@Cheney, thanks for the hint. Sorry, I can't see any cause of the problem you encountered from the stack trace. You might have more luck asking in the 'eclipse.tools.buckminster' newsgroup.

Tobias Wagner, 19. November, 15:18 Uhr

Hi,

nice tutorial but I´m having problems in step:
Exporting a p2 site for the application using Buckminster (2)

If I right-click of my com.eclipse.mail.site feature and say : Buckminster -> invoke actions an error message appears saying:

CSpec
org.eclipse.rcp:feature$3.5.1.R35x_v20090811-9SA0FxVFqE70OL1ARMrfcO6e7BA6 has no action, group, or local artifact named source.feature.jars

Does anyone has a solution for that problem?

TW

Tobias Wagner, 19. November, 15:49 Uhr

Gave it a second try with same error.
I´m quite sure that I followed your tutorial and have no idea what could be the problem

Ralf Ebert, 19. November, 18:11 Uhr

I assume you tried restarting Eclipse already? I remember that Buckminster wouldn't show actions directly after I created the project. Otherwise, you might have more luck asking in the 'eclipse.tools.buckminster' newsgroup.

Tobias Wagner, 19. November, 19:13 Uhr

Hi,
I´ve addet a cquery file to my feature and deleted it and now I´m able to add actions. Very strange think its a bug.

Tobias Wagner, 20. November, 06:49 Uhr

Hi, I´ve fixed the error.
I added a cquery file to my mail.site feature. After adding it i deleted it instantly. Since then I was able to add an action like you described in your tutorial. I don´t know if this has anything to do with my system configuration but it seems like a bug to me.

Tobias Wagner, 23. November, 14:20 Uhr

Hi,

I´m having other problems now. I´ve set up a hudson server with buckminster plugin. I downloaded your project to ensure that I have not made any errors during the eclipse part of your tutorial. I´ve downloaded a Buckminster-headless and extractet my target Platform. I´ve also entered all Paths in hudson. When I try to build my project I get the following message:

Gestartet durch Benutzer anonymous
Commandline:
java -Dbuckminster.output.root=/C:/hudson/jobs/rcp_target/workspace//buckminster.output -Dbuckminster.temp.root=/C:/hudson/jobs/rcp_target/workspace//buckminster.temp -DtargetPlatformPath=C:/buckminsterTargetPlatform -jar plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar -application org.eclipse.buckminster.cmdline.headless -data /C:/hudson/jobs/rcp_target/workspace/ --loglevel info -S C:\hudson\jobs\rcp_target\builds\2009-11-23_15-13-24/commands.txt INFO: import 'file:///D:/workspaces/buckminster/com.example.target/target.mspec'
ERROR [0001] : No suitable provider for component com.example.target:eclipse.feature was found in resourceMap file:/D:/workspaces/buckminster/com.example.target/target-resources.rmap
ERROR [0001] : No suitable provider for component com.example.target:eclipse.feature was found in searchPath default
ERROR [0001] : Resolution attempt ended with exception: Provider local(file:///C:/hudson/jobs/rcp_target/workspace/com.example.target/): Missing CSpec source required by component type eclipse.feature
ERROR Provider local(file:///C:/hudson/jobs/rcp_target/workspace/com.example.target/): Missing CSpec source required by component type eclipse.feature
INFO: TAG-ID 0001 = Query for com.example.target:eclipse.feature

Archiviere Artefakte
Finished: FAILURE

Maybe you know a solution, because I saw a post from you with a similar problem (http://www.eclipse.org/forums/index.php?S=f9510e808d1e85762010ee0629119c26&t=msg&th=156976)

Ralf Ebert, 24. November, 00:16 Uhr

Tobias, glad to hear it works in the IDE now. Finding the reason for these "Missing CSpec source required by component type eclipse.feature" messages is cumbersome indeed. For me the problem was that Buckminster couldn't write in its own folder, which meant that it couldn't store downloaded artifacts. Sorry, I can't see any clue about what's going wrong from the error message. Maybe ask in the 'eclipse.tools.buckminster' newsgroup about this for some more tips where to look for potential problems...

Tobias Wagner, 24. November, 10:03 Uhr

Hi Ralf,
I did already ask for help in the eclipse newsgroup and now it works.
I did not enter any SVN/CVN Connection and thought that hudson would use the files in my eclipse workspace. Now I know that this is wrong . As soon as I added a svn connection everything worked, because hudson downloaded the workspace to its workspace location and was able to build the project successfully.
So the whole point was a big misunderstanding ^^

Thanks or your support

Henno Vermeulen, 27. Januar, 13:04 Uhr

Thank you for the tutorial.

I followed the tutorial until before the Hudson part, but there I run into problems with the http://download.eclipse.org/tools/buckminster/headless-3.5/ site. When I try to download buckminster-headless (using the same command as on the official "Buckminster Downloads" page) I get

director -r http://download.eclipse.org/tools/buckminster/headless-3.5/ -d temp-buckminster-headless/ -p Buckminster -i
org.eclipse.buckminster.cmdline.product
Unable to load repositories.
Application failed, log file location: C:\Users\h.vermeulen\Oblomowdev\director\
configuration\1264596913052.log

So I downloaded the entire headless site using the link on the Buckminster Downloads page and running the command on the local site works perfectly.
However when I try to install the needed features I get this:

buckminster install http://download.eclipse.org/tools/buckminster/headless-3.5/ org.eclipse.buckminster.core.headless.feature
No suitable feature/version found that matches org.eclipse.buckminster.core.headless.feature.feature.group

Problems with the eclipse site? It's a real showstopper for us to set up our continuous integration...
Should I register to bugzilla and file a bug report? Is there a way to manually download and install the features? Or am I doing something wrong?

Henno Vermeulen, 27. Januar, 13:42 Uhr

Because this issue is not specific to your tutorial, I decided to post to the Buckminster forum, my post can be found here:

http://www.eclipse.org/forums/index.php?t=msg&goto=510414&#msg_510414

Henno Vermeulen, 28. Januar, 13:17 Uhr

Thank you for the tutorial I got it all working now! The 3.5 update site is online again by the way. I also had an issue on windows when installing the second feature into the headless Buckminster, it turned out that I needed to specify an absolute path when installing it with the Director, after that installing the features works flawlessly.

It is still a bit of black magic to me how everything works together and how I can customize it for us. But I suppose reading the Buckminster book might help a lot with that.

erdal, 03. Februar, 14:24 Uhr

create.product.zip creates a zip that contains an empty root dir.
The p2 site is generated, the product and the executable as well.
Any hints?

erdal, 03. Februar, 15:19 Uhr

OK, I forgot the trailing slash in:

<products alias="destination" base="${buckminster.output}">
<path path="mail.${target.ws}.${target.os}.${target.arch}/" />
</products>

ViK, 04. Februar, 14:53 Uhr

Hi Ralf,

I encountered myself with a problem related with platform specific fragments. Just wanted to add here my feedback in case someone faces the same problem. You can read the discussion at Buckminster's newsgroup:

http://www.eclipse.org/forums/index.php?t=msg&th=162028&start=0&

It seems buckminster, while importing the component query, was locating bundles from the target platform, but (silently) rejecting because it did not match the platform filters. That led to several errors, and unsuccessful builds. Thomas Hallgren already issued a bugzilla and immediately fixed it.

So, considering this is a tutorial for a multiple-platform build, I think it would make sense to add that the following values to the component query example:

<cq:property key="target.arch" value="*"/>
<cq:property key="target.os" value="*"/>
<cq:property key="target.ws" value="*"/>

Maybe I missed something in your tutorial. I know you suggested to specify those through a properties file when making a buckminster build within eclipse. Would it make sense to include those values in the cquery file of the tutorial?

Thanks for this great tutorial :D

ViK

Ralf Ebert, 04. Februar, 21:40 Uhr

@ViK, thanks for investigating this and posting a comment about it. I did the same thing in a different way, I configured the .target to include all environments. This is also mentioned in the tutorial: "Uncheck Include Required Software so that you can check Include all environments (otherwise the target is only suitable for building on your own platform)". Probably I should make this more eye-catching.

Stephan, 17. Februar, 12:13 Uhr

Hi Ralf,
Thank you for the tutorial. I still have two questions about it:
1) What is the best place to set the Java compiler settings to be used in the Buckminster build (e.g., with/without debug info, warning-settings, etc)?
2) My product build always failed for solaris/gtk/sparc and it took me a while to find out that Eclipse Platform Launcher does not contain these launchers by default. So I had to download the delta pack and change the rcp.target to point to the downloaded delta pack. Maybe these launchers are used less frequently so they are not included or do you know any other reason ?
Cheers, Stephan

Ralf Ebert, 28. Februar, 11:33 Uhr

Stephan,

1) I configure the warnings and errors in the project properties. I also add the projects .settings folder to my version control, so every developer and the headless builds are using the same settings. Some things can also be configured in the build.properties, f.e. the javacDefaultEncoding. Probably there are more settings available here.
2) I guess so, you might ask on the newsgroup eclipse.technology.equinox if there is a particular reason why these are not included.

Ken, 07. März, 01:18 Uhr

Great tutorial! I've tried to get buckminster working before and was so overwhelmed. This article is a nice concise way to get going. I was successful getting everything to work in eclipse, and then got things to work with Hudson, except Mac builds fail with Mac BrandingIron error (http://www.eclipse.org/forums/index.php?t=msg&goto=511121&). Has this been resolved? I tried messing with the patch, but it got complicated.

My other reason for posting is I'm trying to create a windows batch file that can create my build. It seems to do the importtargetdefinition okay, but when I call:
buckminster import "C:\eclipse-galielo-workspace\com.example.mail.buckminster\com.example.mail.site\site.cquery" I get:
!ENTRY org.eclipse.buckminster.core 4 293 2010-03-06 19:54:24.721
!MESSAGE ERROR [0001] : No suitable provider for component com.example.mail.site:eclipse.feature was found in resourceMap file:/C:/eclipse-galielo-workspace/com.example.mail.buckminster/com.example.mail.site/site.rmap
ERROR [0001] : No suitable provider for component com.example.mail.site:eclipse.feature was found in searchPath resources
ERROR [0001] : Resolution attempt ended with exception: Provider local(file:///C:/tmp/buckminster/workspace/com.example.mail.site/): Missing CSpec source required by component type eclipse.feature
ERROR Provider local(file:///C:/tmp/buckminster/workspace/com.example.mail.site/): Missing CSpec source required by component type eclipse.feature

!ENTRY org.eclipse.buckminster.core 1 293 2010-03-06 19:54:24.767
!MESSAGE TAG-ID 0001 = Query for com.example.mail.site:eclipse.feature

I think I actually had this figured out at one point, but now I cannot remember the solution. I thought I had to add -D"buckminster.temp.root=c:\tmp", but that doesn't seem to work anymore.

Can anyone figure out how to create a batch file (or ANT file) that runs the headless build?

Many thanks in advance,
Ken

Thomas Hallgren, 06. April, 06:51 Uhr

@Ralf. I think the 'Include all platforms' setting is required at all times, but ViK's proposal about setting the os/ws/arch to '*' in the cquery covers one additional case, and that is if someone adds a platform dependent fragment to the example. Here's the reason I bring this up: https://bugs.eclipse.org/bugs/show_bug.cgi?id=308135

Maarten Meijer, 04. Juni, 13:36 Uhr

When working on mac osx for some reason buckminster doesn't get the application id stored. Solution create a bash script as follows:
#!/bin/bash
BASEDIR=`dirname $0`
cd $BASEDIR
$BASEDIR/buckminster -application org.eclipse.buckminster.cmdline.headless $@

and use this to install the features

Miles Parker, 07. Juli, 02:52 Uhr

Hi Ralf,

Thanks for the hugely helpful post. I wanted to point out that the Buckminster plugin now has aut-install, so you don't need all of those steps. Or you wouldn't unless oyu're on a Mac and run into this problem: http://www.eclipse.org/forums/index.php?t=msg&th=163425&start=0& -- oh, and I see you didn't only run into it, you reported it. :)

cheers,

Miles

Michael Huber, 21. Juli, 13:06 Uhr

Hi Ralf,

thanks for this very helpful tutorial.
I tried to also run junit tests using buckminster 3.6, but I run into the following problem:
No suitable provider for component org.junit4:osgi.bundle was found in searchPath resources

I am kind of stuck, as I couldn't find any documentation how to fix it.
Does anyone here have an idea or a hint?

Beer, 06. August, 13:36 Uhr

Hi Ralf,

I went into a problem based on the product.ant file. The repository was prefixed with file: which caused a nonhierarchical URI exception because in the end it was file:file:URI.
So after modifing the product.ant file and removing file: everything works fine!

Thanks a lot!

I'm looking forward to your comments:

Schulungen

Eclipse RCP

Ralf Ebert | Blog | Eclipse RCP | Headless Eclipse RCP builds with Buckminster and Hudson