Skip to content

Creating and Using an Eclipse Update Site using Maven, Tycho and Github

Last updated on 2014-09-07

After deciding that it was about time to learn maven, I managed to convert all of my projects to maven, using m2e and tycho. Everything was fine until I decided to use non-eclipse libraries inside my eclipse projects. This is one of the points I REALLY hate about eclipse – its either their way or the highway.

I wanted to use the guava library in my project, so I created an eclipse plugin project from jar, changed it to a maven project, updated everything and BOOM – project config is destroyed. This is because eclipse manages dependencies in one file (MANIFEST.MF) and maven manages the dependencies in another file (obviously you know this, pom.xml). And it’s either one or the other.

So after some trying I gave up and stopped using maven for a couple of days. This was a very good thing because it let my brain do background processing to find the solution which somehow I couldn’t find. And while it breaks some of maven’s philosophy, it works: manage the libraries manually in a simple plug-in project, deploy it to a repository (p2, of course) and use this repository in the other eclipse projects that use the libraries. And what better place to put my repository than in github? So here is the tale of my journey.

First, instead of creating a plugin project from jars, I created a simple plugin project with no content. To this project I added a directory that contains all of the jars I wanted, added them to the plugin project configuration (stating also the exported packages). The directory was then added as a resource directory to the pom.xml file, like this:

<!-- inside the build section -->

At this point maven (actually m2e) told me that the project was outdated so I should run Maven->Update Project but I am now smarter so I will not do this, because it simply destroys the eclipse project configuration, so DON’T DO IT.

Anyway, after this, I had to add all of the needed eclipse boilerplate projects (feature, p2, and releng) in order to create the site in an ordered way (this tutorial will teach you how to do it). And now for the final touch: putting the update site in github. At first I copied the results (using maven) of the build to another directory where a git repository is located, but then I remembered that my project is also at github, so I can use the project directly as an update site (just need remove the .gitignore entries for jar files). So doing this, the update site is easy to config in the using project (note the use of raw in the address, to get the real file and not the github page of the file):

<!-- My Repo -->

The actual dependencies plugin dependencies are managed in the MANIFEST.MF file, and not in the maven file.

The files where all of these steps were applied can be found here. Enjoy!

Enhanced by Zemanta
Published inProgramming

Be First to Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.