Some time ago I had some problems maintaining my CI (Continuous Integration) build. I run my CI build in Tracis-CI, which hooks to Github and on every repository change pulls the latest commit and build it. Don’t remember how it happened but one day it stopped working, and I was too lazy to fix it. I said to myself “I’m the only person working on this project, so why should I invest time in CI?”
This week I paid the price.
On Sunday I did a small change in one of my project. Nothing too big, just some files. And when I compiled the sources using Maven instead of the standard eclipse build, one of my project could not find one of the classes located in another project. Strange… Everything worked fine inside Eclipse, but with Maven, things just didn’t work. I cleaned all my project, changed definitions… nothing worked.
I am working in a plug-in for Eclipse, and here the problem starts – and this is the reason CI is important: Eclipse resolves dependencies differently than java. Every plug-in project has its own
MANIFETS.MF file which manages the plug-in dependencies for the project. And the dependencies are also Eclipse plug-ins. So in order for this to work with Maven, you have to use the Tycho Maven plug-in, which is able to build eclipse plugins and resolve dependencies using the
MANIFEST.MF files. On top of this, Eclipse has its own definition of a repository (called p2). So you also need to create a special type of repository to resolve the dependencies. BTW, lot’s of thanks to Lars Vogels for his tutorial on using Tycho and creating and publishing it to an FTP location.
And here I was, with a broken build and no idea why and when it broke. So I spent two days (calendar days. But actually a few hours because I have to earn a living) digging through my repository history to understand what was broken. It turned out that I had deleted by mistake a line in one of my Eclipse build files and doing so removed all the sources from the build. But the worse part was that after fixing my local Maven build, Travis-CI didn’t work! This took away three more days (again calendar days) until I found the problem – this time it was a plug-in dependency that was defined in Maven. After removing the dependency from the
pom (remembering it is managed by the
MANIFEST.MF file), my build is now green again.
Once again I learned the importance of CI, not only in theory but also in practice. And also of having an external CI system that builds everything from scratch. My plug-ins are now built by three systems: the Eclipse platform, local Maven and Travis-CI. But only the last one gives me the true status of the build since it works in a completely clean environment. So please learn something from my wasted time, and use CI. It is worth the effort. And tons of thanks to the people who maintain Travis-CI. It is simply awesome.
Be First to Comment