Archives de catégorie : conferences

Tycho presentation and tutorial at EclipseCon 2011

Building plugins with Tycho

When I entered the room, I got handed over a usb stick with an archive named theinternet.zip (we’ll see what’s inside during the tutorial); the room is packed, the session is beginning in few minutes.

Presentation of Tycho;

  • Jan first defined the audience what is Tycho about : a way to build Eclipse/OSGi artifacts with Maven,
  • then who are the nowadays contributors : SAP, Sonatype and Intalio
  • who is using it : the contributors, for sure; and EGit, P2, JBoss tools, Eclipse Memory Analyzer, JRebel, etc…
  • the relation between Maven and Tycho : Tycho is solving dependencies from Manifest.MF, features.xml; and is working in a Manifest first approach compared to a pom.xml first.(but it can also be used in a pom first approach)
  • the relation between P2 and Tycho : Tycho produces P2 repositories; Tycho consumes P2 repositories and its metadata
  • the relation between PDE and Tycho : tycho uses the same artifacts (Manifest.mf, build.properties, feature.xml, site.xml) and is actually complementary to PDE UI; but is a competitor to PDE headless mode.
  • where is tycho : open source, incubating in Eclipse foundation, code base on github

After those good words, Pascal demoed tycho

  • Pascal showed some p2 projects being built with Tycho (all p2 projects contained their pom.xml, defining the name of the plugin, and the type : eclipse-plugin or eclipse-feature actually) ; he had also to add a parent pom to be able to build all at once : he cd’ed to to the p2 agregator project and a simple « mvn clean install »; later; tycho began the magic; during the compilation, Pascal talked about is PDE doing compared to tycho (for example the steps order is different) after 1min  and a half later; the crowd applauded Pascal : the p2 projects were built; pretty fast.
  • Then Pascal cd’ed to another project : eclipse webtools xml; he located the parent project and launched a pom.xml : to show how easy it is for a newcomer (since he did not know this project) to build a tycho based project : just run « mvn clean install » and you’re done : perfect for getting new contributors to join (no more « it does not work on my desktop » whining anymore.)
  • Adding more steps to the build; Pascal was able to demo Tycho executing the maven findbugs plugin during his build; just adding the maven plugin configuration step in the pom.xml
  • Moving on, Pascal showed us the integration of the Egit Tycho build in Hudson, with findbugs report

Questions :

  • is it using JDT compiler ? yes
  • can i exclude plugins or features from a build ? tycho does not checkout your sources; you can use hudson for that (no maps to define what is getting downloaded)
  • no possibility to build against different JDT versions; code coverage is not provided yet : Igor, Jan and Pascal answered that the API is opened and even though tycho is production ready; some aspects are not yet covered; but anybody can contribute to it to cover more particular aspects.
  • Releasing the p2 repository built by Tycho to Nexus is not available now : to publish p2 repos to Nexus Pro, Sonatype sends a zip file to Nexus that explodes and exposes it; during the year, some hooks will be added to do a better integration between p2 repos built with tycho and Nexus Pro.

Coffee break : Pascal is announcing a book about tycho is coming soon (Yai!).

The tutorial

  • Unzip the archive, backup your current .m2 settings folder; and create a new one with the given settings.xml present : the idea of those steps is to do everything offline, using settings that only consider local artifacts
  • Start the provided nexus : /var/tmp/eclipsecon2011/nexus/bin/jsw/linux-x86-64/nexus start
  • Access nexus pro (trial version) http://localhost:8081/nexus/ (admin/admin123)
  • unzip a custom built eclipse : unzip eclipsecon2011.tycho.tutorial.ide-linux.gtk.x86_64.zip
  • create a new rcp app; add to it the right pom.xml, and « mvn clean install « it from eclipse, using m2eclipse provided (and do not forget to use a good eclipse.ini because the permgenspace error popped in my face several times !); then we added a test (using a fragment), a feature, a repository and finally a product
  • Igor then added the build to Hudson : it built fast !

Lessons learned

  • stop using a site.xml; use a category.xml to define an eclipse-repository
  • talking to Jan and Pascal, integration testing is not totally obvious with Tycho; I could first create a product, and run those integration tests against a built product;  instead of launching integration tests during a normal build phase; anyway from their experiences, integration testing is not that mandatory for your projects; focus more on normal unit testing first
  • before defining a product, launch it a first time, and base your product definition on this launch configuration
  • in a UI based  product, add org.eclipse.rcp feature; so that you will be able to build your product for multiple platforms (this whole native library stuff, swt; actually on linux x64 I did not need to add this feature to make my product work)
  • Define aggregator : instead of putting all your modules in the parent pom, you can create an aggregator pom which will define your modules; so that your parent is free of modules dependencies (can be built alone); speaking with Igor, there is no « truth »about maven tycho layouts; actually m2eclipse supports nested projects in
  • Tycho 0.11 will be out when it is ready; ie the product is P2 updatable without hooks
  • Igor clearly recommends not using the -tycho.targetPlatfrom option; it just loads the jars in a basic way; if anything bad happens, impossible to debug
  • Nexus professional will add support for hosting custom P2 repos (containing your stuff; it will allow you tycho build to publish the built p2 repo to nexus) throughout the year –> I can’t wait for this killer feature!

Great presentation & tutorial ! Kudos to Pascal, Jan, and Igor for sharing their knowledge and their patience during the tutorial !