OSGi development with IntelliJ

September 11, 2011


In my day job I spend a lot of time doing OSGi development in Eclipse. We use Eclipse because we are building plug-ins for the Eclipse IDE, so it seems to make sense to use Eclipse for our development environment as it comes all set up for that sort of thing.

However, it’s not all fun and sunshine. I don’t like Eclipse as an IDE. I don’t trust it’s searching and refactoring tools 100%. Too many times I’ve searched for something that I know is in there but the search comes back empty. Yes, I’m probably forgetting to set some search parameter correctly but it happens often enough that I can’t believe any results it gives me.

I don’t like it’s auto-completion mechanism. I don’t like the way that it moves the cursor and makes assumptions about what I’m about to type. I can’t count the number of times I’ve just wanted to type a single opening quote, a short String literal, and then a closing quote only to have Eclipse “helpfully” give me two pairs of quotes at each end of the literal and a compilation error because it’s not enclosed. I could go on at length, and it’s very tempting to rant, but I think I can summarise it with an analogy @nasalter made to me a few months ago.

Using Eclipse is like buying an old car. It does its job fine most of the time but sometimes it just won’t start, you have to learn all its little quirks, you’ll probably have to get your head under the bonnet at some point to figure out why it’s acting up, and when you buy it you’ll need to do some work on it to get it up to standard like replacing headlights that don’t quite work.

On the other hand, IntelliJ is like buying a brand new modern car. It’s reliable, you can trust it not to break down unexpectedly, all it’s features work and it has all the features you need by default (hand brake, headlights, mirrors etc.) without the need to attach them yourself, you never have to open the bonnet and tinker with the engine under normal circumstances, it just works.

I know that Eclipse can be configured to address most of what I’m complaining about, but that configuration can take quite a long time. Am I alone in being too lazy to track down and tweak every setting and download every additional plug-in for Eclipse to get it set up just right? I’m pretty sure most people just end up tolerating its defaults but that’s not how it should be. A default installation of IntelliJ just works for me. It has all the functionality I want built in already for the majority of any work I’m going to undertake. It’s defaults make sense to me and above all, I trust it’s searching and refactoring tools. “Develop with pleasure” is the JetBrains motto, and it really is true.

So I thought I’d investigate if it’s practical to do my Eclipse plug-in development in IntelliJ. I’ll be using the Osmorc plug-in to add OSGi support because I’ll be using the community edition rather than Ultimate Edition (where OSGi support comes by default). I will write up my experiences and some instructions eventually. I’m really hoping that it works.

For the record, I hate buying cars, I’m more of a motorbike guy. I am also aware that you can buy new cars that are lemons and everything goes wrong with them but I’m ignoring all of that for the purpose of this article.